Sha256: ad8db25eddfdd185727ec3b8b27728f7933d14936b4c662263529096c74ef03e

Contents?: true

Size: 276 Bytes

Versions: 1

Compression:

Stored size: 276 Bytes

Contents

module Danconia
  class Currency < Struct.new(:code, :symbol, :description, keyword_init: true)
    def self.find code, exchange
      return code if code.is_a? Currency
      new exchange.currencies.find { |c| c[:code] == code } || {code: code, symbol: '$'}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danconia-0.2.2 lib/danconia/currency.rb