Sha256: e6474bbfe169baef062963fe4214b224bec71dd91bfd1776df3eaa55676d1ba2
Contents?: true
Size: 525 Bytes
Versions: 11
Compression:
Stored size: 525 Bytes
Contents
# frozen_string_literal: true # Allows Writing of 100.to_money for +Numeric+ types # 100.to_money => #<Money @cents=10000> # 100.37.to_money => #<Money @cents=10037> class Numeric def to_money(currency = nil) Money.new(self, currency) end end # Allows Writing of '100'.to_money for +String+ types # Excess characters will be discarded # '100'.to_money => #<Money @cents=10000> # '100.37'.to_money => #<Money @cents=10037> class String def to_money(currency = nil) Money.parse(self, currency) end end
Version data entries
11 entries across 11 versions & 1 rubygems