Created
May 22, 2013 18:05
-
-
Save laser/5629587 to your computer and use it in GitHub Desktop.
class level thread safety...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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