Class_eval and Instance_eval

For class_eval, the class scope also becomes the target object, so def creates instance methods for that class/module.

For instance_eval, the class scope becomes the singleton class (aka metaclass, eigenclass) of the target object. Instance methods created on the singleton class for an object become singleton methods for that object. Singleton methods for a class or module are what are commonly (and somewhat inaccurately) called class methods.

Reference

http://stackoverflow.com/questions/900419/how-to-understand-the-difference-between-class-eval-and-instance-eval