From: Brad Hilton Date: 2004-03-30T10:30:18+09:00 Subject: Re: calling break in proc nobu.nokada@softhome.net wrote: > Hi, > > At Tue, 30 Mar 2004 04:02:54 +0900, > Brad Hilton wrote in [ruby-talk:96055]: > >>The code works with ruby 1.8.1, but not with 1.8-cvs or 1.9. > > > And works with latest 1.8 and 1.9 in cvs. > My app is still raising an error, so I've simplified things as much as possible with a test script. The original example I provided does now work with the latest cvs, but the following does not: ---------------------------------- class DelayedFetcher def initialize(&block) @block = block @rows = nil end def load_data return if @rows @rows = [] @block.call(proc { |hash| @rows << hash }) end # load_data def call load_data @rows.each { |row| yield(row) } end end # DelayedFetcher # create an object that lazily loads some data obj = DelayedFetcher.new { |block| 10.times do |i| block.call({ 'i' => i }) end } data_handler = proc { |hash| p hash break if hash['i'] == 5 } obj.call(&data_handler) --------------------------------- I hope this helps to track down the problem. Thanks, Brad