RubyMoney/money · error · Money::Bank::UnknownRateFormat
Money::Bank::UnknownRateFormat
Error message
Money::Bank::UnknownRateFormat
What it means
Error "Money::Bank::UnknownRateFormat" thrown in RubyMoney/money.
Source
Thrown at lib/money/bank/variable_exchange.rb:221
# Available formats are +:json+, +:ruby+ and +:yaml+.
#
# @param [Symbol] format Request format for the resulting string.
# @param [String] file Optional file location to write the rates to.
# @param [Hash] opts Options hash to set special parameters. Backwards compatibility only.
#
# @return [String]
#
# @raise +Money::Bank::UnknownRateFormat+ if format is unknown.
#
# @example
# bank = Money::Bank::VariableExchange.new
# bank.set_rate("USD", "CAD", 1.24515)
# bank.set_rate("CAD", "USD", 0.803115)
#
# s = bank.export_rates(:json)
# s #=> "{\"USD_TO_CAD\":1.24515,\"CAD_TO_USD\":0.803115}"
def export_rates(format, file = nil, _opts = {})
raise Money::Bank::UnknownRateFormat unless RATE_FORMATS.include?(format)
store.transaction do
s = FORMAT_SERIALIZERS[format].dump(rates)
unless file.nil?
File.write(file, s)
end
s
end
end
# This should be deprecated.
def rates
store.each_rate.with_object({}) do |(from, to, rate), hash|
hash[[from, to].join(SERIALIZER_SEPARATOR)] = rate
end
endView on GitHub (pinned to 26e2829c34)
When it happens
Trigger: Thrown at lib/money/bank/variable_exchange.rb:221 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RubyMoney/money@26e2829c34 (2026-08-23).
Data as JSON: /api/errors/618ee1223c4e0060.
Report an issue: GitHub.