Module: CurrencyConvertible
- Included in:
- Numeric
- Defined in:
- lib/simple_xurrency/currency_convertible.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/simple_xurrency/currency_convertible.rb', line 6 def method_missing(method, *args, &block) return _from(method.to_s) if method.to_s.length == 3 if @original && !(method.to_s =~ /^to_(utc|int|str|ary)/) && method.to_s =~/^to_/ && method.to_s.length == 6 return _to(*[method.to_s.gsub('to_',''), args].flatten) end if @original && !(method.to_s =~ /^(singleton_methods|protected_methods)/) && method.to_s =~/^to_[a-z]{3}_updated_at/ && method.to_s.length == 17 return _updated_at(method.to_s.slice(3..5)) end super(method,*args,&block) end |