Class: OpenEHR::AM::Archetype::ConstraintModel::Primitive::CInteger

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

Direct Known Subclasses

CReal

Instance Attribute Summary collapse

Attributes inherited from CPrimitive

#assumed_value, #default_value, #type

Instance Method Summary collapse

Methods inherited from CPrimitive

#has_assumed_value?

Constructor Details

#initialize(args = { }) ⇒ CInteger

Returns a new instance of CInteger.



127
128
129
130
131
132
133
# File 'lib/openehr/am/archetype/constraint_model/primitive.rb', line 127

def initialize(args = { })
  args[:type] ||= 'Integer'
  super
  consistency(args[:list], args[:range])
  @list = args[:list]
  @range = args[:range]
end

Instance Attribute Details

#list ⇒ Object

Returns the value of attribute list.



125
126
127
# File 'lib/openehr/am/archetype/constraint_model/primitive.rb', line 125

def list
  @list
end

#range ⇒ Object

Returns the value of attribute range.



125
126
127
# File 'lib/openehr/am/archetype/constraint_model/primitive.rb', line 125

def range
  @range
end

Instance Method Details

#valid_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


145
146
147
148
149
# File 'lib/openehr/am/archetype/constraint_model/primitive.rb', line 145

def valid_value?(value)
  return false unless value.is_a?(Integer)

  constrained_value?(value)
end