Skip to content

Instantly share code, notes, and snippets.

@jperry
Created June 22, 2012 14:05
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 jperry/2972902 to your computer and use it in GitHub Desktop.
Save jperry/2972902 to your computer and use it in GitHub Desktop.
class instance variable
class Test
def self.test_variable
@test_variable ||= 0
end
def self.test_variable=(n)
@test_variable = n
end
def initialize
self.class.test_variable += 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment