struct Money::Currency::Rate

Included Modules

Defined in:

money/currency/json.cr
money/currency/rate.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(from : Currency, to : Currency, value : BigDecimal, updated_at : Time = Time.utc) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def <=>(other : Rate) : Int32 #
Description copied from module Comparable(Money::Currency::Rate)

The comparison operator. Returns 0 if the two objects are equal, a negative number if this object is considered less than other, a positive number if this object is considered greater than other, or nil if the two objects are not comparable.

Subclasses define this method to provide class-specific ordering.

The comparison operator is usually used to sort values:

# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]

# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]

[View source]
def clone #

[View source]
def copy_with(from _from = @from, to _to = @to, value _value = @value, updated_at _updated_at = @updated_at) #

[View source]
def from : Currency #

def to : Currency #

def to_json(json : JSON::Builder) #

[View source]
def to_s(io : IO, *, include_updated_at = false) : Nil #

[View source]
def to_s(*, include_updated_at = false) : String #

[View source]
def updated_at : Time #

def value : BigDecimal #