Sha256: 3354007f034fc3edb6b7bf5c68e2f37f95b014f9fbc299a31913e68e02d69e44
Contents?: true
Size: 629 Bytes
Versions: 10
Compression:
Stored size: 629 Bytes
Contents
class Object # Synonymous with #clone, this is an interesting # method in that it promotes prototype-based Ruby. # Now Classes aren't the only things that respond to #new. # # "ABC".new => "ABC" # def new self.clone end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCKernel < Test::Unit::TestCase def test_new q = nil s = "Testing" assert_nothing_raised { q = s.new } assert_equal( s, q ) assert_not_equal( s.object_id, q.object_id ) end end =end
Version data entries
10 entries across 10 versions & 1 rubygems