Last active
December 18, 2015 15:39
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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