Value: make objects Comparable

This commit is contained in:
josh committed 2013-08-11 14:59:43 -04:00
1 parent 983861c1dc
commit 05cf6093d7
2 files changed
+12

No files matched your search

+6
View File
@@ -1,5 +1,7 @@
module Gnucash
class Value
include Comparable
attr_accessor :val
def initialize(val)
@@ -27,5 +29,9 @@ module Gnucash
def to_s
sprintf("%.02f", @val / 100.0)
end
def <=>(other)
@val <=> other.val
end
end
end