class MultiThreadedSimpleRandom
Public Class Methods
instance()
click to toggle source
# File lib/simple-random/multi_threaded_simple_random.rb, line 7 def instance unless @instances extend MonitorMixin self.synchronize do @instances ||= {} end end instance_id = Thread.current.object_id unless @instances[instance_id] self.synchronize do @instances[instance_id] ||= new end end @instances[instance_id] end