class OpenEHR::AM::Archetype::ConstraintModel::CAttribute

Attributes

children[R]
existence[R]
rm_attribute_name[R]

Public Class Methods

new(args = { }) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 144
def initialize(args = { })
  super(args)
  self.rm_attribute_name = args[:rm_attribute_name]
  self.existence = args[:existence]
  self.children = args[:children]
end

Public Instance Methods

children=(children) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 165
def children=(children)
  @children = children.inject([]) do |array, child|
    child.parent = self
    array << child
  end if children
end
existence=(existence) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 158
def existence=(existence)
  if !existence.nil? && (existence.lower < 0 || existence.upper > 1)
    raise ArgumentError, 'invalid existence'
  end
  @existence = existence
end
has_children?() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 172
def has_children?
  !@children.nil? and !@children.empty?
end
path() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 176
def path
  @path || calculate_path
end
rm_attribute_name=(rm_attribute_name) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 151
def rm_attribute_name=(rm_attribute_name)
  if rm_attribute_name.nil? or rm_attribute_name.empty?
    raise ArgumentError, 'invalid rm_attribute_name'
  end
  @rm_attribute_name = rm_attribute_name
end

Private Instance Methods

calculate_path() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 182
def calculate_path
  path_left_part = parent_path
  path_left_part += '/' if path_left_part != '/'

  @path = path_left_part + rm_attribute_name
end