Skip to content

Instantly share code, notes, and snippets.

@vasilakisfil
Last active August 29, 2015 13:57
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 vasilakisfil/9722841 to your computer and use it in GitHub Desktop.
Save vasilakisfil/9722841 to your computer and use it in GitHub Desktop.
Share state between ruby objects
class TestClass
@class_var_alternative = "class_var_alternative"
class << self
attr_accessor :class_var_alternative
end
end
puts TestClass.class_var_alternative
TestClass.class_var_alternative = "new value"
puts TestClass.class_var_alternative
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment