Module: Mochigome::Formatting

Defined in:
lib/formatting.rb

Class Method Summary collapse

Class Method Details

.percentify(n, d) ⇒ Object



3
4
5
# File 'lib/formatting.rb', line 3

def self.percentify(n, d)
  ("%.1f%%" % ((n.to_f*100)/d.to_f)) if (!d.nil? && d > 0)
end