Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/dm_ruby_extensions/extend_numeric.rb
Instance Method Summary collapse
-
#percent_of(num, precision = 0) ⇒ Object
——————————————————————————.
Instance Method Details
#percent_of(num, precision = 0) ⇒ Object
5 6 7 |
# File 'lib/dm_ruby_extensions/extend_numeric.rb', line 5 def percent_of(num, precision = 0) num.zero? ? 0 : (to_f / num * 100.0).round(precision) end |