From: Paul Lutus Date: 2006-12-11T06:25:05+09:00 Subject: Re: Scope of block daniel wrote: > > Paul Lutus schreef: > >> >> Perhaps you will be satisfied that the block receive values from the >> parent environment. This is the normal way to solve the problem. >> > > That is how it is solved now, but the proc needs to be flexible. > I call much proc's and i don't now what to pass. > It are not just vars that i want to accessible but also methods ed > > Any idea ? Use instance variables. ------------------------------------- #!/usr/bin/ruby -w class BlockTest attr_accessor :val attr_accessor :myblock def process(&block) self.myblock = block end end t = BlockTest.new t.val = "Daniel" t.process { "var = #{t.val}" } p t.myblock.call ------------------------------------- I understand this is not a particularly pretty example, it is just meant to show one approach. -- Paul Lutus http://www.arachnoid.com