Created
March 25, 2010 17:51
-
-
Save ericanderson/343894 to your computer and use it in GitHub Desktop.
HELP! How to use a variable at the module scope within a class
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
module Q | |
x = 3 | |
class C | |
def stuff | |
puts x | |
end | |
end | |
end | |
x = Q::C.new.stuff | |
# NameError: undefined local variable or method `x' for #<Q::C:0x100348c20> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment