Class: OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CDvScale
- Inherits:
-
Archetype::ConstraintModel::CDomainType
- Object
- Archetype::ConstraintModel::ArchetypeConstraint
- Archetype::ConstraintModel::CObject
- Archetype::ConstraintModel::CDefinedObject
- Archetype::ConstraintModel::CDomainType
- OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CDvScale
- Defined in:
- lib/openehr/am/openehr_profile/data_types/quantity.rb
Overview
RM 1.1.0: the AOM constraint for DV_SCALE, mirroring CDvOrdinal (an enumeration of allowed value/symbol pairs) except DV_SCALE.value is Real rather than Integer.
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Attributes inherited from Archetype::ConstraintModel::CDefinedObject
Attributes inherited from Archetype::ConstraintModel::CObject
#node_id, #occurrences, #rm_type_name
Attributes inherited from Archetype::ConstraintModel::ArchetypeConstraint
Instance Method Summary collapse
- #any_allowed? ⇒ Boolean
-
#initialize(args = { }) ⇒ CDvScale
constructor
A new instance of CDvScale.
- #valid_value?(value) ⇒ Boolean
Methods inherited from Archetype::ConstraintModel::CDomainType
Methods inherited from Archetype::ConstraintModel::CDefinedObject
#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 = { }) ⇒ CDvScale
Returns a new instance of CDvScale.
74 75 76 77 |
# File 'lib/openehr/am/openehr_profile/data_types/quantity.rb', line 74 def initialize(args = { }) super self.list = args[:list] end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
72 73 74 |
# File 'lib/openehr/am/openehr_profile/data_types/quantity.rb', line 72 def list @list end |
Instance Method Details
#any_allowed? ⇒ Boolean
79 80 81 |
# File 'lib/openehr/am/openehr_profile/data_types/quantity.rb', line 79 def any_allowed? @list.nil? end |
#valid_value?(value) ⇒ Boolean
83 84 85 86 87 88 89 90 |
# File 'lib/openehr/am/openehr_profile/data_types/quantity.rb', line 83 def valid_value?(value) return true if any_allowed? return false unless value.respond_to?(:value) && value.respond_to?(:symbol) list.any? do |item| item.value == value.value && symbol_code(item.symbol) == symbol_code(value.symbol) end end |