Created
August 25, 2011 14:51
-
-
Save isaacsanders/1170838 to your computer and use it in GitHub Desktop.
Def within a def
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 Example | |
def foo | |
def foo | |
:every_other_call | |
end | |
:first_call | |
end | |
end | |
ex = Example.new | |
ex.foo | |
#=> :first_call | |
ex.foo | |
#=> :every_other_call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment