Class: Float

Inherits:
Object show all
Defined in:
lib/core_extensions/float.rb

Instance Method Summary collapse

Instance Method Details

#to_formatted_percentObject



6
7
8
# File 'lib/core_extensions/float.rb', line 6

def to_formatted_percent
  to_percent.to_s + '%'
end

#to_percent(digits_after_decimal = 2) ⇒ Object



2
3
4
# File 'lib/core_extensions/float.rb', line 2

def to_percent(digits_after_decimal=2)
  (self * 100).round digits_after_decimal
end