Class: OpenEHR::AM::Archetype::ConstraintModel::ArchetypeConstraint

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

Direct Known Subclasses

CAttribute, CObject

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#parentObject

Returns the value of attribute parent.



7
8
9
# File 'lib/openehr/am/archetype/constraint_model.rb', line 7

def parent
  @parent
end

#pathObject

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?

Returns:

  • (Boolean)


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

Returns:

  • (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

Returns:

  • (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