Printable BigDecimal

Posted . Visible to the public.

By default BigDecimal values are formatted in a not very user friendly way, to make BigDecimals look like float but still retain the distiction the following monkey-patch can be used

BigDecimal.class_eval do
  def inspect
    "#<#{self.class.name} #{to_f}>"
  end
end
Ev Dolzhenko
Posted by Ev Dolzhenko to Ev's deck (2013-11-04 17:31)