From: Matt Kussow Date: 2002-02-17T11:21:58+09:00 Subject: LocalJumpError when defining each The following script seems to work with ruby version 1.6.5, but not with 1.6.6. Is this a bug or new "correct behavior"? ----------------------------------------- #!/usr/bin/env ruby class MyClass def initialize @data = [1, 2, 3] end def each @data.each end end myc = MyClass.new myc.each { |x| print x, "\n" } -------------------------------------------- RESULT ruby 1.6.5 1 2 3 RESULT ruby 1.6.6 ../t.1:9:in `each': no block given (LocalJumpError) from ./t.1:9:in `each' from ./t.1:15 Passing the block explicitly solves the problem, but obviously is not quite as clean. ---------------------------------- #!/usr/bin/env ruby class MyClass def initialize @data = [1, 2, 3] end def each(&block) @data.each(&block) end end myc = MyClass.new myc.each { |x| print x, "\n" } ------------------------------------ Thanks in advance, Matt