Class: OpenEHR::AM::Archetype::ConstraintModel::CAttribute

Inherits:
ArchetypeConstraint show all
Defined in:
lib/openehr/am/archetype/constraint_model.rb

Direct Known Subclasses

CMultipleAttribute, CSingleAttribute

Instance Attribute Summary collapse

Attributes inherited from ArchetypeConstraint

#parent

Instance Method Summary collapse

Methods inherited from ArchetypeConstraint

#congruent?, #has_path?

Constructor Details

#initialize(args = { }) ⇒ CAttribute

Returns a new instance of CAttribute.



179
180
181
182
183
184
# File 'lib/openehr/am/archetype/constraint_model.rb', line 179

def initialize(args = { })
  super(args)
  self.rm_attribute_name = args[:rm_attribute_name]
  self.existence = args[:existence]
  self.children = args[:children]
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



177
178
179
# File 'lib/openehr/am/archetype/constraint_model.rb', line 177

def children
  @children
end

#existenceObject

Returns the value of attribute existence.



177
178
179
# File 'lib/openehr/am/archetype/constraint_model.rb', line 177

def existence
  @existence
end

#rm_attribute_nameObject

Returns the value of attribute rm_attribute_name.



177
178
179
# File 'lib/openehr/am/archetype/constraint_model.rb', line 177

def rm_attribute_name
  @rm_attribute_name
end

Instance Method Details

#has_children?Boolean

Returns:

  • (Boolean)


207
208
209
# File 'lib/openehr/am/archetype/constraint_model.rb', line 207

def has_children?
  !@children.nil? and !@children.empty?
end

#node_conforms_to?(other) ⇒ Boolean

Whether this (potentially specialised) attribute node is a legal redefinition of other: same rm_attribute_name and an existence no wider than the parent's.

Returns:

  • (Boolean)


218
219
220
221
222
223
# File 'lib/openehr/am/archetype/constraint_model.rb', line 218

def node_conforms_to?(other)
  return false if other.nil?

  rm_attribute_name == other.rm_attribute_name &&
    interval_conforms_to?(existence, other.existence)
end

#pathObject



211
212
213
# File 'lib/openehr/am/archetype/constraint_model.rb', line 211

def path
  @path || calculate_path
end