Sha256: 4dc401111a1e3edb377cf518da20f30ee4edeec3fbb1559db0c56f02786d50d7
Contents?: true
Size: 630 Bytes
Versions: 16
Compression:
Stored size: 630 Bytes
Contents
module Kernel # 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
16 entries across 16 versions & 1 rubygems