Sha256: 56296831f53dcea37abab9631cc74dff2633bdac56de521536c3882cdadcd903
Contents?: true
Size: 363 Bytes
Versions: 2
Compression:
Stored size: 363 Bytes
Contents
class Float def pretty_print "%0.2f"% self end def percentage of_total = 1 ( (self/of_total)*100.0 ).pretty_print << "%" end def to_money Money.new(self) end end class Money include Comparable def <=> other @f <=> other end def initialize f @f = Float(f) end def pretty_print "$#{@f.pretty_print}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
Pratt-1.6.5 | lib/pratt/core_ext/float.rb |
Pratt-1.6.4 | lib/pratt/core_ext/float.rb |