class
Money::Currency::Exchange
- Money::Currency::Exchange
- Reference
- Object
Included Modules
- JSON::Serializable
- YAML::Serializable
Direct Known Subclasses
Defined in:
money/currency/exchange.crmoney/currency/json.cr
money/currency/yaml.cr
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new(rate_store : Money::Currency::RateStore | Nil = nil, rate_provider : Money::Currency::RateProvider | Nil = nil)
Instance Method Summary
-
#base_currencies : Array(Currency)
Returns an array of supported (registered) base currencies.
- #exchange(from : Money, to : String | Symbol | Currency) : Money
-
#exchange_rate(base : String | Symbol | Currency, target : String | Symbol | Currency) : BigDecimal
Returns the exchange rate between base and target currency, or raises
UnknownRateError
if not found. -
#exchange_rate?(base : String | Symbol | Currency, target : String | Symbol | Currency) : BigDecimal | Nil
Returns the exchange rate between base and target currency, or
nil
if not found. - #rate_provider : RateProvider
- #rate_provider=(rate_provider : RateProvider | Nil)
- #rate_store : RateStore
- #rate_store=(rate_store : RateStore | Nil)
-
#target_currencies : Array(Currency)
Returns an array of supported (registered) target currencies.
Constructor Detail
def self.new(rate_store : Money::Currency::RateStore | Nil = nil, rate_provider : Money::Currency::RateProvider | Nil = nil)
#
Instance Method Detail
Returns an array of supported (registered) base currencies.
def exchange_rate(base : String | Symbol | Currency, target : String | Symbol | Currency) : BigDecimal
#
Returns the exchange rate between base and target currency,
or raises UnknownRateError
if not found.
def exchange_rate?(base : String | Symbol | Currency, target : String | Symbol | Currency) : BigDecimal | Nil
#
Returns the exchange rate between base and target currency,
or nil
if not found.
Returns an array of supported (registered) target currencies.