module CurrencyNumberal
rubocop:disable Metrics/ModuleLength
Constants
- CURRENCIES
- VERSION
Public Class Methods
exchange_rate(base:, code:, rate:)
click to toggle source
# File lib/currency_numberal.rb, line 9 def self.exchange_rate(base:, code:, rate:) raise Error, 'Invalid base' unless CurrencyNumberal::CURRENCIES.key?(base) raise Error, 'Invalid code' unless CurrencyNumberal::CURRENCIES.key?(code) CurrencyNumberal::CURRENCIES[code][:base] = rate * 1.usd.jpy.to_f end