Dup does not duplicate singleton methods

M

Mystifier

------=_NextPart_000_003C_01C506F8.C0F33EB0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit

irb(main):001:0> a = Object.new
=> #<Object:0x2ae06d8>
irb(main):002:0> def a.p
irb(main):003:1> print "in a.p"
irb(main):004:1> end
=> nil
irb(main):005:0> a.p
in a.p=> nil
irb(main):006:0> b = a.dup
=> #<Object:0x2ad8668>
irb(main):007:0> b.p
NoMethodError: private method `p' called for #<Object:0x2ad8668>
from (irb):7
irb(main):008:0>

Duplication of singleton methods is not desirable?

Mystifier

------=_NextPart_000_003C_01C506F8.C0F33EB0--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top