Enhanced Ruby Fixnum class
class Fixnum
# Format a number with commas and a decimal point
def commify
to_s =~ /([^\.]*)(\..*)?/
int, dec = $1.reverse, $2 ? $2 : ""
while int.gsub!(/(,|\.|^)(\d{3})(\d)/, '\1\2,\3')
end
int.reverse + dec
end
def is_even?
self % 2 == 0
end
def is_odd?
!is_even?
end
end