-
-
Save anonymous/6fad0c1a62e7aa09120b 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
### How is method(:bar) scoped in this case? (Within class A? Within class B? neither? Is the new B instance implicitly "self" within the do block?) | |
### The '@' in @var makes var an instance variable? | |
### A.new.foo returns a hash containing the key :key? | |
class A | |
def foo | |
@val = B.new do | |
{ | |
key: method(:bar) | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment