Sha256: 36826584875715b54ea4571f67fc6dc7004d14f8dcb8a852f49d67dbc6a17918
Contents?: true
Size: 607 Bytes
Versions: 26
Compression:
Stored size: 607 Bytes
Contents
class NilClass # Allows <tt>nil</tt> to respond to #size. # Always returns <tt>0</tt>. # # nil.size #=> 0 # def size; 0; end # Allows <tt>nil</tt> to respond to #length. # Always returns <tt>0</tt>. # # nil.length #=> 0 # def length; 0; end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TC_NilClass < Test::Unit::TestCase def test_length assert_equal( 0, nil.length ) end def test_size assert_equal( 0, nil.size ) end end =end
Version data entries
26 entries across 26 versions & 1 rubygems