Class: EventMachine::IRC::SynchronizedStore

Inherits:
Object
  • Object
show all
Defined in:
lib/eventmachine/irc/server.rb

Direct Known Subclasses

Channel

Instance Method Summary collapse

Constructor Details

#initializeSynchronizedStore

Returns a new instance of SynchronizedStore.



23
24
25
26
# File 'lib/eventmachine/irc/server.rb', line 23

def initialize
	@store = {}
	#@mutex = Mutex.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



28
29
30
31
32
# File 'lib/eventmachine/irc/server.rb', line 28

def method_missing(name,*args)
	#@mutex.synchronize { 
     @store.__send__(name,*args)
   #}
end

Instance Method Details

#each_valueObject



34
35
36
37
38
39
40
41
42
# File 'lib/eventmachine/irc/server.rb', line 34

def each_value
	#@mutex.synchronize do
		@store.each_value {|u|
			#@mutex.unlock
			yield u
			#@mutex.lock
		}
     #end
end

#keysObject



44
45
46
47
48
# File 'lib/eventmachine/irc/server.rb', line 44

def keys
	#@mutex.synchronize{
     @store.keys
   #}
end