Sha256: 50607998ad20ad841b5aa25e8a7b948e8a6bd0c9cc99edf74b708ea2e96c26af
Contents?: true
Size: 499 Bytes
Versions: 1
Compression:
Stored size: 499 Bytes
Contents
require "bigdecimal" class Code class Object class Decimal < ::Code::Object attr_reader :raw def initialize(decimal, exponent: nil) @raw = BigDecimal(decimal) @raw = @raw * 10**exponent.raw if exponent end def to_s raw.to_s("F") end def inspect to_s end def ==(other) raw == other.raw end alias_method :eql?, :== def hash [self.class, raw].hash end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
template-ruby-0.1.0 | lib/code/object/decimal.rb |