Method: Momm::Calculator#method_missing

Defined in:
lib/momm/calculator.rb

#method_missing(meth, *args, &block) ⇒ Object

@TODO: Refactoring



127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/momm/calculator.rb', line 127

def method_missing(meth, *args, &block)
  meth = meth.to_s
  case
  when meth.match(/^exchange_rate_from_(\w+)_to_(\w+)/)
    exchange_rate($1.upcase.to_sym, $2.upcase.to_sym, *args, &block)
  when meth.match(/^exchange_from_(\w+)_to_(\w+)/)
    money, *res = args
    exchange(money, $1.upcase.to_sym, $2.upcase.to_sym, *res, &block)
  else
    super
  end
end