Parent

Methods

Included Modules

Numeric

Public Instance Methods

to_bytes() click to toggle source

TODO: Use 1024?

# File lib/familia/core_ext.rb, line 124
def to_bytes
  args = case self.abs.to_i
  when (1000)..(1000**2)
    '%3.2f%s' % [(self / 1000.to_f).to_s, 'KB']
  when (1000**2)..(1000**3)
    '%3.2f%s' % [(self / (1000**2).to_f).to_s, 'MB']
  when (1000**3)..(1000**4)
    '%3.2f%s' % [(self / (1000**3).to_f).to_s, 'GB']
  when (1000**4)..(1000**6)
    '%3.2f%s' % [(self / (1000**4).to_f).to_s, 'TB']
  else
    [self.to_i, 'B'].join
  end
end
to_ms() click to toggle source
# File lib/familia/core_ext.rb, line 119
def to_ms
  (self*1000.to_f)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.