Module: Quantity::CalculationSupport
Instance Method Summary
collapse
#quantifiable?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, value) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/unitmanager/quantity.rb', line 12
def method_missing(name, value)
if supported_operation? name
return perform_operation(value, name)
else
super.method_missing(name, value)
end
end
|
Instance Method Details
#==(other) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/unitmanager/quantity.rb', line 20
def == (other)
return false if other == nil
return false unless other.kind_of?(self.class)
value == other.value && unit == other.unit
end
|
#coerce(other) ⇒ Object
27
28
29
|
# File 'lib/unitmanager/quantity.rb', line 27
def coerce(other)
[QuantityInfo.new(other, nil), self]
end
|