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

Inherits:
ObjectID
  • Object
show all
Defined in:
lib/open_ehr/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.



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

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.



153
154
155
# File 'lib/open_ehr/rm/support/identification.rb', line 153

def name
  @name
end

#version_idObject

Returns the value of attribute version_id.



153
154
155
# File 'lib/open_ehr/rm/support/identification.rb', line 153

def version_id
  @version_id
end

Instance Method Details

#valueObject



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

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

#value=(value) ⇒ Object

Raises:

  • (ArgumentError)


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

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