Sha256: c5ce79fabb5ec2e1dbf696869e76b1cd6b6b4a01919d2d836b7bad8e4f4ecc8d

Contents?: true

Size: 747 Bytes

Versions: 471

Compression:

Stored size: 747 Bytes

Contents

class Numeric
  KILOBYTE = 1024
  MEGABYTE = KILOBYTE * 1024
  GIGABYTE = MEGABYTE * 1024
  TERABYTE = GIGABYTE * 1024
  PETABYTE = TERABYTE * 1024
  EXABYTE  = PETABYTE * 1024

  # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
  def bytes
    self
  end
  alias :byte :bytes

  def kilobytes
    self * KILOBYTE
  end
  alias :kilobyte :kilobytes

  def megabytes
    self * MEGABYTE
  end
  alias :megabyte :megabytes

  def gigabytes
    self * GIGABYTE
  end
  alias :gigabyte :gigabytes

  def terabytes
    self * TERABYTE
  end
  alias :terabyte :terabytes

  def petabytes
    self * PETABYTE
  end
  alias :petabyte :petabytes

  def exabytes
    self * EXABYTE
  end
  alias :exabyte :exabytes
end

Version data entries

471 entries across 422 versions & 42 rubygems

Version Path
activesupport-4.2.11.3 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.11.2 lib/active_support/core_ext/numeric/bytes.rb
motion-support-1.2.1 motion/core_ext/numeric/bytes.rb
motion-support-1.1.1 motion/core_ext/numeric/bytes.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/numeric/bytes.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/activesupport-4.2.11.1/lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.11.1 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.11 lib/active_support/core_ext/numeric/bytes.rb
motion-support-1.2.0 motion/core_ext/numeric/bytes.rb
activesupport-4.2.10 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.10.rc1 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.9 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.9.rc2 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.9.rc1 lib/active_support/core_ext/numeric/bytes.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activesupport-4.2.8/lib/active_support/core_ext/numeric/bytes.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.8 lib/active_support/core_ext/numeric/bytes.rb
activesupport-4.2.8.rc1 lib/active_support/core_ext/numeric/bytes.rb
activesupport-3.2.22.5 lib/active_support/core_ext/numeric/bytes.rb
activesupport-3.2.22.4 lib/active_support/core_ext/numeric/bytes.rb