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

Inherits:
DvAmount show all
Defined in:
lib/open_ehr/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_refference_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?, #other_reference_ranges=

Methods inherited from Basic::DataValue

#==

Constructor Details

#initialize(args = {}) ⇒ DvQuantity

Returns a new instance of DvQuantity.



234
235
236
237
238
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 234

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

Instance Attribute Details

#precisionObject

Returns the value of attribute precision.



232
233
234
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 232

def precision
  @precision
end

#unitsObject

Returns the value of attribute units.



232
233
234
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 232

def units
  @units
end

Instance Method Details

#is_integral?Boolean

Returns:

  • (Boolean)


263
264
265
266
267
268
269
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 263

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

#is_strictly_comparable_to?(others) ⇒ Boolean

Returns:

  • (Boolean)


252
253
254
255
256
257
258
259
260
261
# File 'lib/open_ehr/rm/data_types/quantity.rb', line 252

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