OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/lib/big_decimal_patch.rb

21 lines
378 B

module BigDecimalPatch
module BigDecimal
::BigDecimal.send :include, self
def to_d; self end
end
module Integer
::Integer.send :include, self
def to_d; to_f.to_d end
end
module String
::String.send :include, self
def to_d; ::BigDecimal.new(self) end
end
module NilClass
::NilClass.send :include, self
def to_d; 0 end
end
end