Created
October 1, 2012 17:44
-
-
Save davorb/3813267 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 TestClass | |
def initialize | |
if defined?(@@app_created) | |
Window.new | |
return | |
end | |
@@app_created = true | |
puts "app hasn't been created, so I'll make one" | |
end | |
end | |
class Window | |
def initialize | |
puts "the app has been created, so I'll make a window instead" | |
end | |
end | |
TestClass.new # first class | |
TestClass.new # second class | |
## output: | |
# app hasn't been created, so I'll make one | |
# the app has been created, so I'll make a window instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment