Skip to content

Instantly share code, notes, and snippets.

@aereal
Created July 7, 2011 09:50
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 aereal/1069207 to your computer and use it in GitHub Desktop.
Save aereal/1069207 to your computer and use it in GitHub Desktop.
Class local variable
class Foo
@x = :class_local_var
class << self
attr_accessor :x
end
end
Foo.x # -> :class_local_var
Foo.x = 1
Foo.x # -> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment