Instance_eval

Can anyone explain the use of instance_eval and provide the example?

On 09 Jan 2008, at 09:00, Ayyanar from Aspire Systems wrote:

Can anyone explain the use of instance_eval and provide the example?

Google “instance_eval” first results in the list:
http://redhanded.hobix.com/inspect/testingDeeplyWithInstance_eval.html
http://toolmantim.com/article/2006/11/29/instance_eval_brings_sexy_back

http://blog.jayfields.com/2007/03/ruby-instanceeval-and-classeval-
method.html

Best regards

Peter De Berdt

The third links is fruitful.

Can one one simplify it more?

I think, it is used to include a variable in the instance which is not
originally available in the class.