Class: Integer
Instance Method Summary collapse
-
#string_length ⇒ Object
Returns the length of the number's string representation.
Instance Method Details
#string_length ⇒ Object
Returns the length of the number's string representation.
7 8 9 10 11 12 |
# File 'lib/shenanigans/integer/string_length.rb', line 7 def string_length return 1 if zero? len = Math.log10(abs).floor.next positive? ? len : len.next end |