Class: OpenEHR::AM::OpenEHRProfile::DataTypes::Basic::CDvState

Inherits:
Archetype::ConstraintModel::CDomainType show all
Defined in:
lib/openehr/am/openehr_profile/data_types/basic.rb

Instance Attribute Summary collapse

Attributes inherited from Archetype::ConstraintModel::CDefinedObject

#assumed_value

Attributes inherited from Archetype::ConstraintModel::CObject

#node_id, #occurrences, #rm_type_name

Attributes inherited from Archetype::ConstraintModel::ArchetypeConstraint

#parent, #path

Instance Method Summary collapse

Methods inherited from Archetype::ConstraintModel::CDomainType

#standard_equivalent

Methods inherited from Archetype::ConstraintModel::CDefinedObject

#any_allowed?, #default_value, #has_assumed_value?

Methods inherited from Archetype::ConstraintModel::CObject

#node_conforms_to?, #path, #to_rm

Methods inherited from Archetype::ConstraintModel::ArchetypeConstraint

#congruent?, #has_path?, #node_conforms_to?

Constructor Details

#initialize(args = { }) ⇒ CDvState

Returns a new instance of CDvState.



11
12
13
14
15
# File 'lib/openehr/am/openehr_profile/data_types/basic.rb', line 11

def initialize(args = { })
  args[:rm_type_name] = 'DvState'
  super
  self.value = args[:value]
end

Instance Attribute Details

#value ⇒ Object

Returns the value of attribute value.



9
10
11
# File 'lib/openehr/am/openehr_profile/data_types/basic.rb', line 9

def value
  @value
end

Instance Method Details

#valid_value?(rm_value) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
# File 'lib/openehr/am/openehr_profile/data_types/basic.rb', line 22

def valid_value?(rm_value)
  return false if rm_value.nil?

  state = matching_state(rm_value)
  return false if state.nil?
  return true unless rm_value.respond_to?(:is_terminal?)

  rm_value.is_terminal? == state.is_a?(TerminalState)
end