0

Lets say I have two string: "$7.99" and "$16.99"

Now, I'm trying to add these values together to get "$24.98". The money could be in a different currency than USD, but the two strings will always be the same currency.

I'm trying to use a combination of the monetize gem (https://github.com/RubyMoney/monetize) and the currency gem (https://github.com/hexorx/currencies)

The currency gem contains all the currency information.

Here is my code:

require 'monetize'        
require 'currencies'
Money.default_bank = ISO4217::Currency::ExchangeBank.new # from the currencies gem doc
m1 = Monetize.parse "$7.99"
m2 = Monetize.parse "$16.99"
m = m1 + m2
puts m

I get the error

I18n::InvalidLocale: :en is not a valid locale

Even though I loaded the currency bank

0 Answers0