From: Paul Lutus Date: 2006-12-11T05:30:07+09:00 Subject: Re: Scope of block daniel wrote: > 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 Perhaps you will be satisfied that the block receive values from the parent environment. This is the normal way to solve the problem. -------------------------------- #!/usr/bin/ruby -w class BlockTest attr_accessor :myblock def process(&block) self.myblock = block end end t = BlockTest.new t.process{ |v| "var = #{v}" } v = "daniel" p t.myblock.call(v) -------------------------------- "var = daniel" -- Paul Lutus http://www.arachnoid.com