Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-pretty-numeric.rb

Instance Method Summary collapse

Instance Method Details

#pretty_inspectObject



5
6
7
8
9
10
# File 'lib/pry-pretty-numeric.rb', line 5

def pretty_inspect
  integral, fractional = super.split('.', 2)
  integral = integral.reverse.gsub(/\d{3}(?!$)/, '\&_').reverse
  fractional = fractional.gsub(/\d{3}(?!$)/, '\&_') if fractional
  [integral, fractional].compact.join('.')
end