Module: SyncHash::Delegator

Defined in:
lib/mega/synchash.rb

Overview

This module is used when a delegate is being used.

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



111
112
113
# File 'lib/mega/synchash.rb', line 111

def [](key)
  @sync.synchronize(::Sync::SH) { @delegate[key] }
end

#[]=(key, value) ⇒ Object



115
116
117
# File 'lib/mega/synchash.rb', line 115

def []=(key, value)
  @sync.synchronize(::Sync::EX) { @delegate[key] = value }
end

#clearObject



123
124
125
# File 'lib/mega/synchash.rb', line 123

def clear
  @sync.synchronize(::Sync::EX) { @delegate.clear }
end

#delete(key) ⇒ Object



119
120
121
# File 'lib/mega/synchash.rb', line 119

def delete(key)
  @sync.synchronize(::Sync::EX) { @delegate.delete(key) }
end

#keysObject



135
136
137
# File 'lib/mega/synchash.rb', line 135

def keys
  @sync.synchronize(::Sync::SH) { @delegate.keys() }
end

#sizeObject



127
128
129
# File 'lib/mega/synchash.rb', line 127

def size
  @sync.synchronize(::Sync::SH) { @delegate.size() }
end

#valuesObject



131
132
133
# File 'lib/mega/synchash.rb', line 131

def values
  @sync.synchronize(::Sync::SH) { @delegate.values() }
end