From: Robert Klemme Date: 2008-11-13T05:52:19+09:00 Subject: Re: Issue with block and getting to local variables On 12.11.2008 21:31, Tarek Other wrote: > Also I'd like that > block of code to be attached to a variable so I can call it were and > when ever. irb(main):001:0> bl = lambda {|a,b| puts a, b} => # > Ok I'm new to ruby and want to do the following, I want to define a > function that is a ble to call a block and I want that block to have > access to the calling function's local variables. irb(main):002:0> def fun irb(main):003:1> x = 1 irb(main):004:1> y = 2 irb(main):005:1> yield x,y irb(main):006:1> end => nil irb(main):007:0> fun &bl 1 2 => nil irb(main):008:0> Kind regards robert