Module: Cms::Extensions::Integer
- Defined in:
- lib/cms/extensions/integer.rb
Instance Method Summary collapse
Instance Method Details
#round_bytes ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/cms/extensions/integer.rb', line 4 def round_bytes if self > 1.megabyte "%0.2f MB" % (self.to_f/1.megabyte) elsif self > 1.kilobyte "%0.2f KB" % (self.to_f/1.kilobyte) else "#{self} bytes" end end |