>>>>> "E" == Eli Bendersky <eliben / gmail.com> writes:

E> - Kernel#eval -

 it's the evil eval, forget it :-)

E> - Object#instance_eval -

E> Is obj.instance_eval("blah") exactly the same as eval("blah", obj) ? 

 You can give only a Proc/Binding to the evil eval

E> work ? Are the contents of the block just treated as a string ?

 no, the block is executed with self = object

E> - Module#class_eval -


moulon% cat b.rb
#!/usr/bin/ruby
class A
end

A.instance_eval {
   p self
   def a
      puts "A::a"
   end
}

A.module_eval {
   p self
   def a
      puts "A#a"
   end
}

A.a
A.new.a
moulon% 

moulon% ./b.rb
A
A
A::a
A#a
moulon% 


Guy Decoux