Class: OpenEHR::RM::DataTypes::Quantity::DvQuantity

Inherits:
DvAmount show all
Defined in:
lib/openehr/rm/data_types/quantity.rb

Constant Summary

Constants included from Support::Definition::BasicDefinition

Support::Definition::BasicDefinition::CR, Support::Definition::BasicDefinition::LF

Instance Attribute Summary collapse

Attributes inherited from DvAmount

#accuracy, #accuracy_percent

Attributes inherited from DvQuantified

#magnitude, #magnitude_status

Attributes inherited from DvOrdered

#normal_range, #normal_status, #other_reference_ranges

Attributes inherited from Basic::DataValue

#value

Instance Method Summary collapse

Methods inherited from DvAmount

#+, #-, #accuracy_is_percent?, #set_accuracy

Methods inherited from DvQuantified

#<=>, #accuracy_unknown?, valid_magnitude_status?

Methods inherited from DvOrdered

#<=>, #is_normal?, #is_simple?

Methods inherited from Basic::DataValue

#==

Constructor Details

#initialize(args = {}) ⇒ DvQuantity

Returns a new instance of DvQuantity.



232
233
234
235
236
# File 'lib/openehr/rm/data_types/quantity.rb', line 232

def initialize(args = {})
  super(args)
  self.units = args[:units]
  self.precision = args[:precision]
end

Instance Attribute Details

#precisionObject

Returns the value of attribute precision.



230
231
232
# File 'lib/openehr/rm/data_types/quantity.rb', line 230

def precision
  @precision
end

#unitsObject

Returns the value of attribute units.



230
231
232
# File 'lib/openehr/rm/data_types/quantity.rb', line 230

def units
  @units
end

Instance Method Details

#is_integral?Boolean

Returns:

  • (Boolean)


261
262
263
264
265
266
267
# File 'lib/openehr/rm/data_types/quantity.rb', line 261

def is_integral?
  if @precision.nil? || precision != 0
    return false
  else
    return true
  end
end

#is_strictly_comparable_to?(others) ⇒ Boolean

Returns:

  • (Boolean)


250
251
252
253
254
255
256
257
258
259
# File 'lib/openehr/rm/data_types/quantity.rb', line 250

def is_strictly_comparable_to?(others)
  unless super(others)
    return false
  end
  if others.units == @units
    return true
  else
    return false
  end
end