Class: OpenEHR::RM::Support::Identification::VersionTreeID
- Inherits:
-
Object
- Object
- OpenEHR::RM::Support::Identification::VersionTreeID
- Defined in:
- lib/openehr/rm/support/identification.rb
Instance Attribute Summary collapse
-
#branch_number ⇒ Object
Returns the value of attribute branch_number.
-
#branch_version ⇒ Object
Returns the value of attribute branch_version.
-
#trunk_version ⇒ Object
Returns the value of attribute trunk_version.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ VersionTreeID
constructor
A new instance of VersionTreeID.
- #is_branch? ⇒ Boolean
- #is_first? ⇒ Boolean
- #value ⇒ Object
- #value=(value) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ VersionTreeID
Returns a new instance of VersionTreeID.
334 335 336 |
# File 'lib/openehr/rm/support/identification.rb', line 334 def initialize(args = {}) self.value = args[:value] end |
Instance Attribute Details
#branch_number ⇒ Object
Returns the value of attribute branch_number.
332 333 334 |
# File 'lib/openehr/rm/support/identification.rb', line 332 def branch_number @branch_number end |
#branch_version ⇒ Object
Returns the value of attribute branch_version.
332 333 334 |
# File 'lib/openehr/rm/support/identification.rb', line 332 def branch_version @branch_version end |
#trunk_version ⇒ Object
Returns the value of attribute trunk_version.
332 333 334 |
# File 'lib/openehr/rm/support/identification.rb', line 332 def trunk_version @trunk_version end |
Instance Method Details
#is_branch? ⇒ Boolean
375 376 377 |
# File 'lib/openehr/rm/support/identification.rb', line 375 def is_branch? !@branch_version.nil? and !@branch_number.nil? end |
#is_first? ⇒ Boolean
379 380 381 |
# File 'lib/openehr/rm/support/identification.rb', line 379 def is_first? trunk_version == '1' end |
#value ⇒ Object
346 347 348 349 350 351 |
# File 'lib/openehr/rm/support/identification.rb', line 346 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) ⇒ Object
338 339 340 341 342 343 344 |
# File 'lib/openehr/rm/support/identification.rb', line 338 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 |