From: Chad Fowler Date: 2004-03-12T13:12:48+09:00 Subject: Re: Win32OLE bug On Thursday, March 11, 2004, at 09:02 PM, Kent Sibilev wrote: > > On Mar 11, 2004, at 7:19 PM, Bret Pettichord wrote: > > I don't know much about win32ole extension, but LocalJumpError has > nothing to do with the extension, but more with how "return" operation > works in Ruby. For example, > > $ ruby -v > ruby 1.9.0 (2004-03-10) [powerpc-darwin] > $ irb > irb(main):001:0> (1..10).each{return} > LocalJumpError: return from proc-closure > from (irb):1 > from (irb):1:in `each' > from (irb):1 > > The thing is that in this case the context of the 'return' has passed > already. > For details check out this discussion: > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/2583 > > >> I'm seeing the following in 1.8.0 (mswin32) using win32ole: >> >> irb(main):009:0> for form in $iec.document.forms >> irb(main):010:1> if form.action == "start" >> irb(main):011:2> return form >> irb(main):012:2> end >> irb(main):013:1> end >> LocalJumpError: unexpected return >> from (irb):11 >> from (irb):9:in `each' >> from (irb):9 >> > Bret, There are probably better ways to do this that I would think of if I weren't so tired, but this one will get you around the JumpError problem. form = callcc do |cc| ie.document.forms.each do |form| if(form.action == "start") cc.call(form) end end end puts form.inspect "#