Does instance_eval metaprogramming tool do the same thing right? Defining a method for a specific instance?
No. instance_eval has nothing to do with defining methods. It evaluates the block in the context of the receiver. Typically, blocks have a lexical scope, including self , a block that is evaluated using instance_eval , evaluated with self , bound to the message recipient.
one = Object.new two = Object.new def one.my_eval; yield end instance_variables
So what is the difference?
They are completely unconnected. It really doesn't make sense to ask about the difference between two unrelated things.
source share