Created
August 21, 2013 17:14
-
-
Save baroquebobcat/6297238 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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