Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # When inspecting a BigDecimal in the console, default to
- # printing it as a float. This is purely cosmetetic and
- # is easier to read compared to scientific notation.
- #
- # Before:
- # [1] pry(main)> d = BigDecimal.new(10)
- # => 0.1e2
- #
- # After:
- # [1] pry(main)> d = BigDecimal.new(10)
- # => 10.0
- #
- module BigDecimalInspectFloat
- def inspect
- to_s('F')
- end
- end
- BigDecimal.send(:prepend, BigDecimalInspectFloat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement