You can move a method from one instance to another within the same class hiarachy.

J

J2M

You can take a method from one instance and move it to another instance
with

me = cls.method:)mymthd) <== get hold of the method
unbnd = me.unbind <== unbind it from the class
newinst = NewClass.new <== create instance of a subclass of cls
unbnd.bind(newinst).call <== bind the method to the instance of
NewClass

I know it isn't copying it but is shows the mobility of unbound
methods. Not sure if you can copy it while it is an unbound method?
 

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

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top