7
7stud --
pickaxe2 lists module_eval as an instance method of Module. But:
num = 10
puts Object.module_eval('num')
---> 10
puts self
-->main
puts self.class
-->Object
puts self.module_eval('num')
undefined method `module_eval' for main:Object (NoMethodError)
1) Why am I able to call module_eval with a class name, i.e. Object?
2) Why can't I call module_eval with an instance of Object?
num = 10
puts Object.module_eval('num')
---> 10
puts self
-->main
puts self.class
-->Object
puts self.module_eval('num')
undefined method `module_eval' for main:Object (NoMethodError)
1) Why am I able to call module_eval with a class name, i.e. Object?
2) Why can't I call module_eval with an instance of Object?