Sha256: 3bb8ce6d502fbd702e0414a9ebf1e6bbb2e02b9ac11fbefce57a4d943536ad61

Contents?: true

Size: 294 Bytes

Versions: 5

Compression:

Stored size: 294 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 Danconia.config.available_currencies.find { |c| c[:code] == code } || {code: code, symbol: '$'}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
danconia-0.2.9 lib/danconia/currency.rb
danconia-0.2.8 lib/danconia/currency.rb
danconia-0.2.7 lib/danconia/currency.rb
danconia-0.2.6 lib/danconia/currency.rb
danconia-0.2.5 lib/danconia/currency.rb