RubyMoney / eu_central_bank

A gem that calculates the exchange rate using published rates from European Central Bank. Compatible with the money gem
MIT License
217 stars 130 forks source link

Function that checks if the currency is supported #120

Closed KnotScientific closed 1 year ago

KnotScientific commented 2 years ago

Hi, I was wondering if there is/could be a function that returns a boolean on whether or not a currency is supported by eu_central_bank. I know currently there is a function check_currency_available(currency) but that raises an exception if the currency rate doesn't exist. Can there be a function which returns false if the currency rate doesn't exist and true if it does.

def currency_available(currency)?
    currency_string = currency.to_s
    return true if currency_string == "EUR"
    return CURRENCIES.include?(currency_string)
end