From: daniel Date: 2006-12-11T05:20:12+09:00 Subject: Scope of block Hello i have a question about scopes of block I want to define a block at one time. But when it get's called it should have the scope (vars ed ) of the calling environement Example : ------------------------------ class BlockTest attr_accessor :myblock def process(&block) self.myblock = block end end t = BlockTest.new t.process { "var = #{out_of_scope_var}" } out_of_scope_var = "daniel" p t.myblock.call Results in : blocktest.rb:15: undefined local variable or method `out_of_scope_var' for main:Object (NameError) from blocktest.rb:19 How can i call the proc so that the out_of_scope_var is known : result would be : so i would get : daniel-wijnands-powerbook58-2:~/jim/vendor/plugins/widget_grid/lib danielwijnands$ ruby blocktest.rb "var = daniel"