class Float
Public Instance Methods
blank?()
click to toggle source
'true' if the float is 0.0
# File lib/epitools/core_ext/truthiness.rb, line 73 def blank?; self == 0.0; end
float?()
click to toggle source
# File lib/epitools/core_ext/truthiness.rb, line 75 def float?; true; end
percent(decimals=0)
click to toggle source
Convert the float to a rounded percentage string (eg: “42%”). Its argument lets you specify how many decimals to display
eg:
> 0.32786243.percent # => "33%" > 0.32786243.percent(2) # => "32.79%"
# File lib/epitools/core_ext/numbers.rb, line 453 def percent(decimals=0) "%0.#{decimals}f%%" % (self * 100) end