lib/danconia/currency.rb in danconia-0.2.9 vs lib/danconia/currency.rb in danconia-0.3.0

- old
+ new

@@ -1,7 +1,7 @@ module Danconia - class Currency < Struct.new(:code, :symbol, :description, keyword_init: true) - def self.find code, exchange + Currency = Struct.new(:code, :symbol, :description, keyword_init: true) do + def self.find code return code if code.is_a? Currency new Danconia.config.available_currencies.find { |c| c[:code] == code } || {code: code, symbol: '$'} end end end