Class: OpenEHR::RM::DataTypes::Quantity::DvProportion
- Inherits:
-
DvAmount
- Object
- Basic::DataValue
- DvOrdered
- DvQuantified
- DvAmount
- OpenEHR::RM::DataTypes::Quantity::DvProportion
- Includes:
- ProportionKind
- Defined in:
- lib/openehr/rm/data_types/quantity.rb
Overview
end of ProportionKind
Constant Summary
Constants included from ProportionKind
ProportionKind::PK_FRACTION, ProportionKind::PK_INTEGER_FRACTION, ProportionKind::PK_PERCENT, ProportionKind::PK_RATIO, ProportionKind::PK_UNITARY
Constants included from Support::Definition::BasicDefinition
Support::Definition::BasicDefinition::CR, Support::Definition::BasicDefinition::LF
Instance Attribute Summary collapse
-
#denominator ⇒ Object
Returns the value of attribute denominator.
-
#numerator ⇒ Object
Returns the value of attribute numerator.
-
#precision ⇒ Object
Returns the value of attribute precision.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from DvAmount
Attributes inherited from DvQuantified
Attributes inherited from DvOrdered
#normal_range, #normal_status, #other_reference_ranges
Attributes inherited from Basic::DataValue
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ DvProportion
constructor
A new instance of DvProportion.
- #is_integral? ⇒ Boolean
- #is_strictly_comparable_to?(other) ⇒ Boolean
- #magnitude ⇒ Object
Methods included from ProportionKind
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 = {}) ⇒ DvProportion
Returns a new instance of DvProportion.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 318 def initialize(args = {}) self.type = args[:type] self.numerator = args[:numerator] self.denominator = args[:denominator] self.precision = args[:precision] self.magnitude_status =args[:magnitude_status] unless args[:accuracy].nil? set_accuracy(args[:accuracy], args[:accuracy_percent]) else @accuracy, @accuracy_percent = nil, nil end self.normal_range = args[:normal_range] self.normal_status = args[:normal_status] self.other_reference_ranges = args[:other_reference_ranges] end |
Instance Attribute Details
#denominator ⇒ Object
Returns the value of attribute denominator.
316 317 318 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 316 def denominator @denominator end |
#numerator ⇒ Object
Returns the value of attribute numerator.
316 317 318 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 316 def numerator @numerator end |
#precision ⇒ Object
Returns the value of attribute precision.
316 317 318 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 316 def precision @precision end |
#type ⇒ Object
Returns the value of attribute type.
316 317 318 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 316 def type @type end |
Instance Method Details
#is_integral? ⇒ Boolean
382 383 384 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 382 def is_integral? return denominator.integer? && numerator.integer? end |
#is_strictly_comparable_to?(other) ⇒ Boolean
386 387 388 389 390 391 392 393 394 395 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 386 def is_strictly_comparable_to?(other) unless super(other) return false end if other.type == @type return true else return false end end |
#magnitude ⇒ Object
369 370 371 |
# File 'lib/openehr/rm/data_types/quantity.rb', line 369 def magnitude return numerator.to_f/denominator.to_f end |