Skip to content

Instantly share code, notes, and snippets.

@Peeja
Last active December 18, 2015 15:39
Show Gist options
  • Save Peeja/5805630 to your computer and use it in GitHub Desktop.
Save Peeja/5805630 to your computer and use it in GitHub Desktop.
Look at your code. Now back to me. Now back to your code. Now back to me. Your BigDecimals are now readable.
module ReadableBigDecimal
def inspect
"<#{self.class.name}: #{self.to_f}>"
end
end
BigDecimal(10) # => #<BigDecimal:7fcd7103ee68,'0.1E2',9(36)>
BigDecimal.send(:prepend, ReadableBigDecimal)
BigDecimal(10) # => #<BigDecimal: 10>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment