Class: OpenEHR::RM::Support::Identification::TerminologyID

Inherits:
ObjectID
  • Object
show all
Defined in:
lib/openehr/rm/support/identification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ObjectID

#==

Constructor Details

#initialize(args = {}) ⇒ TerminologyID

Returns a new instance of TerminologyID.



154
155
156
157
158
159
160
161
# File 'lib/openehr/rm/support/identification.rb', line 154

def initialize(args = {})
  if args[:value].nil?
    self.name = args[:name]
    self.version_id = args[:version_id]
  else
    super(args)
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



152
153
154
# File 'lib/openehr/rm/support/identification.rb', line 152

def name
  @name
end

#version_idObject

Returns the value of attribute version_id.



152
153
154
# File 'lib/openehr/rm/support/identification.rb', line 152

def version_id
  @version_id
end

Instance Method Details

#valueObject



163
164
165
166
167
168
169
# File 'lib/openehr/rm/support/identification.rb', line 163

def value
  if @version_id.empty?
    @name
  else
    @name + '(' + @version_id + ')'
  end 
end

#value=(value) ⇒ Object

Raises:

  • (ArgumentError)


172
173
174
175
176
177
178
179
180
181
# File 'lib/openehr/rm/support/identification.rb', line 172

def value=(value)
  raise ArgumentError, "value not valid" if value.nil? or value.empty?
  if /(.*)\((.*)\)/ =~ value
    self.name = $1
    self.version_id = $2
  else
    self.name = value
    self.version_id = ''
  end
end