Class: OpenEHR::AM::Archetype::ConstraintModel::ArchetypeConstraint
- Inherits:
-
Object
- Object
- OpenEHR::AM::Archetype::ConstraintModel::ArchetypeConstraint
- Defined in:
- lib/openehr/am/archetype/constraint_model.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #congruent? ⇒ Boolean (also: #is_congruent?)
- #has_path?(search_path) ⇒ Boolean
-
#initialize(args = { }) ⇒ ArchetypeConstraint
constructor
A new instance of ArchetypeConstraint.
- #node_conforms_to?(other) ⇒ Boolean
Constructor Details
#initialize(args = { }) ⇒ ArchetypeConstraint
Returns a new instance of ArchetypeConstraint.
9 10 11 12 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 9 def initialize(args = { }) self.path = args[:path] if args[:path] self.parent = args[:parent] end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
7 8 9 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 7 def parent @parent end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 6 def path @path end |
Instance Method Details
#congruent? ⇒ Boolean Also known as: is_congruent?
25 26 27 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 25 def congruent? path.index(@parent.path) == 0 end |
#has_path?(search_path) ⇒ Boolean
21 22 23 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 21 def has_path?(search_path) path.include?(search_path) end |
#node_conforms_to?(other) ⇒ Boolean
31 32 33 |
# File 'lib/openehr/am/archetype/constraint_model.rb', line 31 def node_conforms_to?(other) path.index(other.path) == 0 end |