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

Inherits:
Object
  • Object
show all
Defined in:
lib/open_ehr/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.



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

#parentObject

Returns the value of attribute parent.



11
12
13
# File 'lib/open_ehr/am/archetype/constraint_model.rb', line 11

def parent
  @parent
end

#pathObject

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?

Returns:

  • (Boolean)


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

Returns:

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

Returns:

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