Sha256: 35c2b5b81065764459848aac31b8475e123df43e3cb43cff0618839ae4b0f825

Contents?: true

Size: 754 Bytes

Versions: 94

Compression:

Stored size: 754 Bytes

Contents

module ActiveSupport #:nodoc:
  module CoreExtensions #:nodoc:
    module Array #:nodoc:
      module RandomAccess
        # This method is deprecated because it masks Kernel#rand within the Array class itself, 
        # which may be used by a 3rd party library extending Array in turn. See
        #
        #   https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4555
        #
        def rand # :nodoc:
          ActiveSupport::Deprecation.warn 'Array#rand is deprecated and will be removed in Rails 3. Use "random_element" instead', caller
          random_element
        end

        # Returns a random element from the array.
        def random_element
          self[Kernel.rand(length)]
        end
      end
    end
  end
end

Version data entries

94 entries across 64 versions & 5 rubygems

Version Path
depengine-0.0.31 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.31 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/array/random_access.rb