Class: Quantity::QuantityInfo
- Inherits:
-
Object
- Object
- Quantity::QuantityInfo
- Includes:
- CalculationSupport
- Defined in:
- lib/unitmanager/quantity.rb
Instance Attribute Summary collapse
-
#unit_sym ⇒ Object
readonly
Returns the value of attribute unit_sym.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, unit_sym) ⇒ QuantityInfo
constructor
A new instance of QuantityInfo.
- #to_quantity(calc) ⇒ Object
Methods included from CalculationSupport
Methods included from Quantifiable
Constructor Details
#initialize(value, unit_sym) ⇒ QuantityInfo
Returns a new instance of QuantityInfo.
61 62 63 64 |
# File 'lib/unitmanager/quantity.rb', line 61 def initialize(value, unit_sym) @value = value @unit_sym = unit_sym end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Quantity::CalculationSupport
Instance Attribute Details
#unit_sym ⇒ Object (readonly)
Returns the value of attribute unit_sym.
59 60 61 |
# File 'lib/unitmanager/quantity.rb', line 59 def unit_sym @unit_sym end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
59 60 61 |
# File 'lib/unitmanager/quantity.rb', line 59 def value @value end |
Instance Method Details
#to_quantity(calc) ⇒ Object
66 67 68 |
# File 'lib/unitmanager/quantity.rb', line 66 def to_quantity(calc) calc.quantity(@value, @unit_sym) end |