Last active
November 16, 2016 17:45
-
-
Save zotherstupidguy/71e45dc0cb1de7e3eb38a89931c808cf to your computer and use it in GitHub Desktop.
nested methods
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
def a &block | |
p "a" | |
def b &block | |
p "b" | |
def c &block | |
p "c" | |
instance_eval &block | |
end | |
instance_eval &block | |
undef :c | |
end | |
instance_eval &block | |
undef :b | |
end | |
# Works | |
a do | |
b do | |
c do | |
end | |
end | |
end | |
# Doesn't Work | |
b do | |
end | |
c do | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://codereview.stackexchange.com/questions/147221/ruby-dsl-nested-constructs