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, valid_percentage

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.



283
284
285
286
287
288
289
# File 'lib/openehr/rm/data_types/quantity.rb', line 283

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

Instance Attribute Details

#precisionObject

Returns the value of attribute precision.



276
277
278
# File 'lib/openehr/rm/data_types/quantity.rb', line 276

def precision
  @precision
end

#unitsObject

Returns the value of attribute units.



276
277
278
# File 'lib/openehr/rm/data_types/quantity.rb', line 276

def units
  @units
end

#units_display_nameObject

RM 1.1.0 (SPECRM-65): units is UCUM by default; units_system names another units system when units isn't UCUM, and units_display_name gives a displayable form when the units code itself isn't one (e.g. UCUM 'Cel' vs '°C'). Both optional.



281
282
283
# File 'lib/openehr/rm/data_types/quantity.rb', line 281

def units_display_name
  @units_display_name
end

#units_systemObject

RM 1.1.0 (SPECRM-65): units is UCUM by default; units_system names another units system when units isn't UCUM, and units_display_name gives a displayable form when the units code itself isn't one (e.g. UCUM 'Cel' vs '°C'). Both optional.



281
282
283
# File 'lib/openehr/rm/data_types/quantity.rb', line 281

def units_system
  @units_system
end

Instance Method Details

#is_integral?Boolean

Returns:

  • (Boolean)


309
310
311
312
313
314
315
# File 'lib/openehr/rm/data_types/quantity.rb', line 309

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

#is_strictly_comparable_to?(others) ⇒ Boolean

Returns:

  • (Boolean)


303
304
305
306
307
# File 'lib/openehr/rm/data_types/quantity.rb', line 303

def is_strictly_comparable_to?(others)
  return false unless super(others)

  others.units == @units && others.units_system == @units_system
end