Module: Phys::UnitsNumericMixin
- Defined in:
- lib/phys/units/units_mixin.rb
Overview
ActiveSupport-like mix-in. Caution: This kind of global change will cause unexpected problems.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'lib/phys/units/units_mixin.rb', line 74 def method_missing(method, *args, &block) if unit=Phys::Unit.find_unit(method) raise "argument must be empty" unless args.empty? Phys::Quantity.new(self,method,unit) else method_missing_units_alias(method, *args, &block) end end |
Instance Method Details
#method_missing_units_alias ⇒ Object
73 |
# File 'lib/phys/units/units_mixin.rb', line 73 alias method_missing_units_alias method_missing |