classObjectContextdefinitialize@number=10enddefevaluate(proc)instance_exec&procendend# our multiplication proct=->{puts(@number*@number)}# evaluate in current context@number=5t.call#=> 25 # evaluate in context of an ObjectFactory instance o=ObjectContext.newo.evaluate(t)#=> 100