Skip to content

Instantly share code, notes, and snippets.

@mhorbul
Created July 10, 2009 23:49
Show Gist options
  • Save mhorbul/144914 to your computer and use it in GitHub Desktop.
Save mhorbul/144914 to your computer and use it in GitHub Desktop.
class MySingleton
@@a = 0
self.class_eval do
def a=(v); @@a = v; end
def a; @@a; end
end
end
puts MySingleton.a # => 0
MySingleton.a = 1
puts MySingleton.a # => 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment