Module: Darthjee::CoreExt::Numeric
- Included in:
- Numeric
- Defined in:
- lib/darthjee/core_ext/numeric.rb
Instance Method Summary collapse
-
#percent_of(total) ⇒ ::Float
Returns the percentage over total.
Instance Method Details
#percent_of(total) ⇒ ::Float
Returns the percentage over total
16 17 18 19 |
# File 'lib/darthjee/core_ext/numeric.rb', line 16 def percent_of(total) return Float::INFINITY if total&.zero? (to_f / total.to_f) * 100.0 end |