Sha256: ac509466ab04a27c025d5f9a621542afd607ae82218c140117a1bdef4007171a

Contents?: true

Size: 1.05 KB

Versions: 147

Compression:

Stored size: 1.05 KB

Contents

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Numeric #:nodoc:
      # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
      module Bytes
        KILOBYTE = 1024
        MEGABYTE = KILOBYTE * 1024
        GIGABYTE = MEGABYTE * 1024
        TERABYTE = GIGABYTE * 1024
        PETABYTE = TERABYTE * 1024
        EXABYTE  = PETABYTE * 1024

        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
    end
  end
end

Version data entries

147 entries across 116 versions & 14 rubygems

Version Path
activesupport-2.3.8.pre1 lib/active_support/core_ext/numeric/bytes.rb
activesupport-2.3.7 lib/active_support/core_ext/numeric/bytes.rb
activesupport-2.3.6 lib/active_support/core_ext/numeric/bytes.rb
radiant-0.8.2 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
radiant-0.9.0.rc2 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
webroar-0.3.1 src/admin_panel/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
webroar-0.3.0 src/admin_panel/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
usher-0.7.0 spec/rails2_3/vendor/rails/vendor/rails/activesupport/pkg/activesupport-2.3.3/lib/active_support/core_ext/numeric/bytes.rb
activesupport-2.3.6.pre lib/active_support/core_ext/numeric/bytes.rb
simply_stated-0.0.5 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/numeric/bytes.rb
simply_stated-0.0.4 vendor/gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/numeric/bytes.rb
ginst-2009.12.8 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
activesupport-2.3.5 lib/active_support/core_ext/numeric/bytes.rb
ginst-2009.11.24 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
ginst-2009.11.23 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
ginst-2.0.1 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
ginst-2.0.0 vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
gemstreamer-1.2.0 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb
gemstreamer-1.1.1 spec/assets/testapp/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb