Skip to content

Instantly share code, notes, and snippets.

@laser
Created May 22, 2013 18:05
Show Gist options
  • Save laser/5629587 to your computer and use it in GitHub Desktop.
Save laser/5629587 to your computer and use it in GitHub Desktop.
class level thread safety...
// defining attr_accessor on singleton Class instance of Foo
class Foo
class << self
attr_accessor :color
end
end
// not threadsafe
class Bar
@@color
def self.color()
@@color
end
def self.color=(c)
@@color = c
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment