Class: OpenEHR::AM::Archetype::ConstraintModel::ArchetypeConstraint
- Inherits:
-
Object
- Object
- OpenEHR::AM::Archetype::ConstraintModel::ArchetypeConstraint
- Defined in:
- lib/open_ehr/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?(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.
13 14 15 16 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 13 def initialize(args = { }) self.path = args[:path] self.parent = args[:parent] end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
11 12 13 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 11 def parent @parent end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 10 def path @path end |
Instance Method Details
#congruent? ⇒ Boolean Also known as: is_congruent?
29 30 31 32 33 34 35 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 29 def congruent? if @path.index(@parent.path) == 0 return true else return false end end |
#has_path?(path) ⇒ Boolean
25 26 27 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 25 def has_path?(path) return @path.include?(path) end |
#node_conforms_to?(other) ⇒ Boolean
39 40 41 42 43 44 45 |
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 39 def node_conforms_to?(other) if @path.index(other.path) == 0 return true else return false end end |