Makes change for configured currencies.
# Initialize your changemaker
# Defaults to USD
ChangeMaker.tap do |c|
# get denominations of 100 cents
c.fewest_number_of_coins(100)
end
# To change to another currency:
ChangeMaker.new(currency: :eur).tap do |c|
# or...
c.currency = :usd
end
Revised
fewest_number_of_coins
usingreduce
(and, of course,tap
):