class OpenEHR::RM::Support::Identification::VersionTreeID

Attributes

branch_number[R]
branch_version[R]
trunk_version[R]

Public Class Methods

new(args = {}) click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 335
def initialize(args = {})
  self.value = args[:value]
end

Public Instance Methods

branch_number=(branch_number) click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 361
def branch_number=(branch_number)
  unless branch_number.nil? or branch_number.to_i >= 1
    raise ArgumentError, 'branch number invalid'
  end
  @branch_number = branch_number
end
branch_version=(branch_version) click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 368
def branch_version=(branch_version)
  if (!branch_version.nil? and !(branch_version.to_i >= 1)) or
      (!branch_version.nil? and @branch_number.nil?)
    raise ArgumentError, 'branch version invalid'
  end
  @branch_version = branch_version
end
is_branch?() click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 376
def is_branch?
  !@branch_version.nil? and !@branch_number.nil?
end
is_first?() click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 380
def is_first?
  trunk_version == '1'
end
trunk_version=(trunk_version) click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 354
def trunk_version=(trunk_version)
  if trunk_version.nil? || (trunk_version.to_i < 1)
    raise ArgumentError, 'trunk_version invalid'
  end
  @trunk_version = trunk_version
end
value() click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 347
def value
  @value = trunk_version
  @value = @value + '.' + @branch_number unless @branch_number.nil?
  @value = @value + '.' + @branch_version unless @branch_version.nil?
  return @value
end
value=(value) click to toggle source
# File lib/open_ehr/rm/support/identification.rb, line 339
def value=(value)
  raise ArgumentError, 'value invalid' if value.nil? or value.empty?
  (trunk_version, branch_number, branch_version) = value.split '.'
  self.trunk_version = trunk_version
  self.branch_number = branch_number
  self.branch_version = branch_version
end