Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/quantify/core_extensions/numeric.rb
Instance Method Summary collapse
-
#method_missing(method, *args, &block) ⇒ Object
Syntactic sugar for defining instances of the Quantity class.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/quantify/core_extensions/numeric.rb', line 11 def method_missing(method, *args, &block) if (method == :to_str || method == :to_ary) super elsif unit = Unit.for(method.to_s) Quantify::Quantity.new self, unit else super end end |