Sha256: 6f7891f4f703f8eca40f3224702a29246a9b1c7de686177ee0f4eedfd8b54c0e

Contents?: true

Size: 274 Bytes

Versions: 1

Compression:

Stored size: 274 Bytes

Contents

class BigDecimal
  def to_s_with_format(*args)
    if args.empty?
      "%.2f" % self
    else
      to_s_without_format(*args)
    end
  end
  alias_method :to_s_without_format, :to_s
  alias_method :to_s, :to_s_with_format
  
  def in_cents
    (self * 100).to_i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
big_decimal_price-0.1.2 lib/big_decimal.rb