Sha256: dfff482ff31e7bee0e3b44e23be2bd41343c64931c5f44fb963b4ad93d5026f7

Contents?: true

Size: 485 Bytes

Versions: 26

Compression:

Stored size: 485 Bytes

Contents

class NilClass

  # Allows <tt>nil</tt> to respond to #[].
  # Always returns nil.
  #
  #  nil[]   #=> nil
  #
  def [](*args)
    nil
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCNilClass < Test::Unit::TestCase

    def test_op_fetch
      assert_equal( nil, nil[] )
      assert_equal( nil, nil[1] )
      assert_equal( nil, nil[1,2,3] )
    end

  end

=end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
facets-1.8.0 lib/facets/core/nilclass/op_fetch.rb
facets-1.8.20 lib/facets/core/nilclass/op_fetch.rb
facets-1.8.49 lib/facets/core/nilclass/op_fetch.rb
facets-1.8.51 lib/facets/core/nilclass/op_fetch.rb
facets-1.8.8 lib/facets/core/nilclass/op_fetch.rb
facets-1.8.54 lib/facets/core/nilclass/op_fetch.rb