Created
April 13, 2016 09:04
-
-
Save britishtea/6fb9153a26825cc7219ef2a9da5ba8c0 to your computer and use it in GitHub Desktop.
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
class Foo | |
def self.bar(&block) | |
instance_exec(&block) | |
end | |
attr_accessor :x | |
end | |
Foo.bar do | |
x = 5 | |
end |
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
class Foo | |
def self.bar(&block) | |
yield(self) | |
end | |
attr_accessor :x | |
end | |
Foo.bar do |foo| | |
foo.x = 5 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment