Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

early return in each'd enumerator is jumping out of each and not method #2736

enebo opened this Issue Mar 20, 2015 · 1 comment


None yet
1 participant
Copy link

enebo commented Mar 20, 2015

I stumbled across this not working on JRuby directly (I usually never hit real bugs in JRuby unless I am working on what someone else reports EXCITING!)...for the humanity...We should not be printing out OH UH. The return is a lexical return and should return from foo:

e = do |yielder|
  [1,2,3].each { |i| yielder << i }

def foo(e)
  e.each do |i|
    p i
    return if i == 2
    p i
  p "OH UH"

foo e

@enebo enebo added this to the milestone Mar 20, 2015


This comment has been minimized.

Copy link
Member Author

enebo commented Mar 20, 2015

I should add if we replace 'e' with an array or standard core data structure this works as expected...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.