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
depengine-0.0.31 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.31 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/numeric/bytes.rb