Class: OpenEHR::RM::Support::Identification::ObjectVersionID

Inherits:
UIDBasedID show all
Defined in:
lib/openehr/rm/support/identification.rb

Instance Attribute Summary collapse

Attributes inherited from UIDBasedID

#extension, #root

Instance Method Summary collapse

Methods inherited from UIDBasedID

#has_extension?

Methods inherited from ObjectID

#==

Constructor Details

#initialize(args = {}) ⇒ ObjectVersionID

Returns a new instance of ObjectVersionID.



245
246
247
# File 'lib/openehr/rm/support/identification.rb', line 245

def initialize(args= {})
  super
end

Instance Attribute Details

#creating_system_idObject

Returns the value of attribute creating_system_id.



243
244
245
# File 'lib/openehr/rm/support/identification.rb', line 243

def creating_system_id
  @creating_system_id
end

#version_tree_idObject

Returns the value of attribute version_tree_id.



243
244
245
# File 'lib/openehr/rm/support/identification.rb', line 243

def version_tree_id
  @version_tree_id
end

Instance Method Details

#is_branch?Boolean

Returns:

  • (Boolean)


291
292
293
# File 'lib/openehr/rm/support/identification.rb', line 291

def is_branch?
  return @version_tree_id.is_branch?
end

#objectidObject



268
269
270
# File 'lib/openehr/rm/support/identification.rb', line 268

def objectid
  return @oid
end

#objectid=(oid) ⇒ Object

Raises:

  • (ArgumentError)


272
273
274
275
# File 'lib/openehr/rm/support/identification.rb', line 272

def objectid=(oid)
  raise ArgumentError, 'objectid is mandatory' if oid.nil?
  @oid = oid
end

#valueObject



262
263
264
265
266
# File 'lib/openehr/rm/support/identification.rb', line 262

def value
  return @oid.value + '::' + 
    @creating_system_id.value + '::' +
    @version_tree_id.value
end

#value=(value) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/openehr/rm/support/identification.rb', line 249

def value=(value)
  if /^(\S+)::(\S+)::((\d|\.)+)$/ =~ value
    self.objectid = UID.new(:value => $1)
    self.creating_system_id = UID.new(:value => $2)
    self.version_tree_id = VersionTreeID.new(:value => $3)
    @value = value
    @root = @oid
    @extension = @creating_system_id.value + '::' + @version_tree_id.value
  else
    raise ArgumentError, 'invalid format'
  end
end