module Money::Currency::Enumeration

Included Modules

Defined in:

money/currency/enumeration.cr

Instance Method Summary

Instance Method Detail

def [](key : String | Symbol) : Currency #

Lookup a currency with given key an returns a Currency instance on success, raises UnknownCurrencyError otherwise.

Money::Currency.find("EUR") # => #<Money::Currency @id="eur">
Money::Currency.find("FOO") # => raises UnknownCurrencyError

[View source]
def []?(key : String | Symbol) : Currency | Nil #

Lookup a currency with given key an returns a Currency instance on success, nil otherwise.

Money::Currency.find("EUR") # => #<Money::Currency @id="eur">
Money::Currency.find("FOO") # => nil

[View source]
def all : Array(Currency) #

[View source]
def each(&) : Nil #
Description copied from module Enumerable(Money::Currency)

Must yield this collection's elements to the block.


[View source]
def find(key : String | Symbol) : Currency #

Lookup a currency with given key an returns a Currency instance on success, raises UnknownCurrencyError otherwise.

Money::Currency.find("EUR") # => #<Money::Currency @id="eur">
Money::Currency.find("FOO") # => raises UnknownCurrencyError

[View source]
def find?(key : String | Symbol) : Currency | Nil #

Lookup a currency with given key an returns a Currency instance on success, nil otherwise.

Money::Currency.find("EUR") # => #<Money::Currency @id="eur">
Money::Currency.find("FOO") # => nil

[View source]