Skip to content

Instantly share code, notes, and snippets.

@yangsu
Created January 28, 2013 03:49
Show Gist options
  • Save yangsu/4652876 to your computer and use it in GitHub Desktop.
Save yangsu/4652876 to your computer and use it in GitHub Desktop.
Ruby Class Variables
module T
@@foo = 'bar'
def self.set(x)
@@foo = x
end
def self.get
@@foo
end
end
p T.get #=> 'bar'
T.set('fubar')
p T::get #=> 'fubar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment