Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Created August 21, 2013 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baroquebobcat/6297238 to your computer and use it in GitHub Desktop.
Save baroquebobcat/6297238 to your computer and use it in GitHub Desktop.
# currently, this prints out
#
# 3
# 3
# 3
#
# I think each should introduce a new scope and the binding should be created for the runnable st
# it captures that scopes `i` instead of having the i be leaked to the outer scope
@@rs = []
def foo r: Runnable
@@rs.add r
end
[1,2,3].each do |i|
foo { puts i}
end
@@rs.each do |r|
r.run
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment