Skip to content

Instantly share code, notes, and snippets.

@divoxx
Created December 15, 2016 17:45
Embed
What would you like to do?
class Foo
@@mutex = Mutex.new
def self.something
@@mutex.synchronize do
return @something if defined?(@something)
@something = init_here
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment