Created
October 12, 2013 14:37
-
-
Save bachue/6950648 to your computer and use it in GitHub Desktop.
Why there's no `yield` in Proc.new but Proc.new can accept the block of the caller?
This file contains hidden or 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
def f | |
Module.new &Proc.new | |
end | |
M = f do | |
def self.x | |
'hello world' | |
end | |
end | |
M.x # => "Hello world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment