Class: Rbgo::SyncHash

Inherits:
Object
  • Object
show all
Defined in:
lib/rbgo/synchronized_collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &blk) ⇒ SyncHash

Returns a new instance of SyncHash.



43
44
45
46
# File 'lib/rbgo/synchronized_collection.rb', line 43

def initialize(*args, &blk)
  @h = Hash.new(*args, &blk)
  @h.extend(MonitorMixin)
end

Class Method Details

.[](*args) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rbgo/synchronized_collection.rb', line 30

def self.[](*args)
  h = SyncHash.new
  h.instance_eval do
    @h = Hash.[](*args)
    @h.extend(MonitorMixin)
  end
end

.try_convert(obj) ⇒ Object



38
39
40
41
# File 'lib/rbgo/synchronized_collection.rb', line 38

def self.try_convert(obj)
  h = Hash.try_convert(obj)
  h.nil? ? nil : SyncHash.[](h)
end