module MoneyExchange

Constants

VERSION

Public Instance Methods

method_missing(meth, *a, &b) click to toggle source

Presume ‘#xxx_to’ style methods as for money exchanges

Calls superclass method
# File lib/money_exchange.rb, line 10
def method_missing(meth, *a, &b)
  case meth
  when /^([a-z]{3})_to_([a-z]{3})$/
    currency, target = $~.captures
    Money.new(self, currency).send("to_#{target}")
  when /^([a-z]{3})_to$/
    currency, targets = $~[1], a
    targets.map { |t| Money.new(self, currency).send("to_#{t}") }
  else
    super
  end
end