Class: Quickdraw::Map

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/quickdraw/map.rb

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.



6
7
8
9
# File 'lib/quickdraw/map.rb', line 6

def initialize
	@hash = {}
	@mutex = Mutex.new
end

Instance Method Details

#[](value) ⇒ Object



11
12
13
# File 'lib/quickdraw/map.rb', line 11

def [](value)
	@hash[value]
end

#[]=(key, value) ⇒ Object



15
16
17
18
19
# File 'lib/quickdraw/map.rb', line 15

def []=(key, value)
	@mutex.synchronize do
		@hash[key] = value
	end
end

#clearObject



25
26
27
28
29
# File 'lib/quickdraw/map.rb', line 25

def clear
	@mutex.synchronize do
		@hash.clear
	end
end

#eachObject



21
22
23
# File 'lib/quickdraw/map.rb', line 21

def each(&)
	@hash.each(&)
end