Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericanderson/343894 to your computer and use it in GitHub Desktop.
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
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