Sha256: 277f4bc76808d8fbf340b16f77bf2710b0cac7732dcd22b42c95e8b6a02b2037
Contents?: true
Size: 862 Bytes
Versions: 9
Compression:
Stored size: 862 Bytes
Contents
class Money # Creates a new Money object of the given value, using the Canadian dollar currency. def self.ca_dollar(cents) new(cents, "CAD") end # Creates a new Money object of the given value, using the American dollar currency. def self.us_dollar(cents) new(cents, "USD") end # Creates a new Money object of the given value, using the Euro currency. def self.euro(cents) new(cents, "EUR") end # Recieve a money object with the same amount as the current Money object # in american dollar def as_us_dollar exchange_to("USD") end # Recieve a money object with the same amount as the current Money object # in canadian dollar def as_ca_dollar exchange_to("CAD") end # Recieve a money object with the same amount as the current Money object # in euro def as_euro exchange_to("EUR") end end
Version data entries
9 entries across 9 versions & 1 rubygems