class Numeric

Public Instance Methods

bits_per_second() click to toggle source
# File lib/pocha-speed-test/speed.rb, line 16
def bits_per_second
        bytes.downcase + "ps"
end
Also aliased as: bps
bps()
Alias for: bits_per_second
bytes(decimals: 2) click to toggle source
# File lib/pocha-speed-test/speed.rb, line 3
def bytes decimals: 2
        string, max = {
                "b"  => 1024,
                "Kb" => 1048576,
                "Mb" => 1073741824,
                "Gb" => 1099511627776
        }.find {|key, max|
                max > self
        }
        
        "%.#{decimals}f%s" % [self * 1024 / max, string]
end