class OpenEHR::AM::Archetype::ConstraintModel::CObject

Attributes

node_id[R]
occurrences[R]
rm_type_name[R]

Public Class Methods

new(args = { }) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 85
def initialize(args = { })
  super
  self.rm_type_name = args[:rm_type_name]
  self.node_id = args[:node_id]
  self.occurrences = args[:occurrences]
end

Public Instance Methods

node_id=(node_id) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 99
def node_id=(node_id)
  if !node_id.nil? && node_id.empty?
    raise ArgumentError, 'invalid node_id'
  end
  @node_id = node_id
end
occurrences=(occurrences) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 106
def occurrences=(occurrences)
  if occurrences.nil?
    raise ArgumentError, 'invaild occurrences'
  end
  @occurrences = occurrences
end
path() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 113
def path
  @path || calculate_path
end
rm_type_name=(rm_type_name) click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 92
def rm_type_name=(rm_type_name)
  if rm_type_name.nil? || rm_type_name.empty?
    raise ArgumentError, 'invalid rm_type_name'
  end
  @rm_type_name = rm_type_name
end
to_rm() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 117
def to_rm
  @rm ||= OpenEHR::RM::Factory.create(rm_type_name, params)
end

Private Instance Methods

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

  if node_id && path_left_part != '/'
    path_right_part = '[' + node_id + ']'
  else
    path_right_part = ''
  end

  @path = path_left_part + path_right_part
end
params() click to toggle source
# File lib/openehr/am/archetype/constraint_model.rb, line 136
def params
  {:path => path, :archetype_node_id => node_id}
end