class Flow::Reference::Currencies

Public Class Methods

find(currency_code) click to toggle source
# File lib/flow-reference.rb, line 13
def find(currency_code)
  code = currency_code.to_s.downcase.gsub(/[^\w]/, '').capitalize
  return nil unless code.length == 3
  return nil unless Data.respond_to?(code)
  Data.send(code)
end
find!(currency_code) click to toggle source
# File lib/flow-reference.rb, line 20
def find!(currency_code)
  find(currency_code) || raise(ArgumentError, 'Currency "%s" is not found' % currency_code)
end