Class: Money

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/pratt/core_ext/float.rb

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ Money

Returns a new instance of Money.



22
23
24
# File 'lib/pratt/core_ext/float.rb', line 22

def initialize f
  @f = Float(f)
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
# File 'lib/pratt/core_ext/float.rb', line 18

def <=> other
  @f <=> other
end

#pretty_printObject



26
27
28
# File 'lib/pratt/core_ext/float.rb', line 26

def pretty_print
  "$#{@f.pretty_print}"
end