Class: Celluloid::Extras::Hash

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/celluloid/extras/hash.rb

Overview

Concurrent Hash mirroring the existing Hash API as an Actor.

Instance Method Summary collapse

Constructor Details

#initialize(starter = {}) ⇒ Hash

Returns a new instance of Hash.



9
10
11
# File 'lib/celluloid/extras/hash.rb', line 9

def initialize(starter={})
  @outer = starter
end

Instance Method Details

#[](k) ⇒ Object



13
14
15
# File 'lib/celluloid/extras/hash.rb', line 13

def [](k)
  @outer[k]
end

#[]=(k, v) ⇒ Object



17
18
19
20
# File 'lib/celluloid/extras/hash.rb', line 17

def []=(k, v)
  @outer.store(k, v)
  v
end

#any?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/celluloid/extras/hash.rb', line 74

def any?
  @outer.any?
end

#countObject



78
79
80
# File 'lib/celluloid/extras/hash.rb', line 78

def count
  @outer.count
end

#delete(k) ⇒ Object



42
43
44
# File 'lib/celluloid/extras/hash.rb', line 42

def delete(k)
  @outer.delete(k)
end

#each(&b) ⇒ Object



46
47
48
# File 'lib/celluloid/extras/hash.rb', line 46

def each(&b)
  @outer.each(&b)
end

#empty?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/celluloid/extras/hash.rb', line 70

def empty?
  @outer.count == 0
end

#inject(s = nil, &b) ⇒ Object



54
55
56
# File 'lib/celluloid/extras/hash.rb', line 54

def inject(s=nil, &b)
  @outer.inject(s, &b)
end

#insert(k, v) ⇒ Object



30
31
32
# File 'lib/celluloid/extras/hash.rb', line 30

def insert(k, v)
  @outer[k] = v
end

#inspectObject



26
27
28
# File 'lib/celluloid/extras/hash.rb', line 26

def inspect
  @outer.inspect
end

#key?(k) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/celluloid/extras/hash.rb', line 22

def key?(k)
  @outer.key?(k)
end

#keysObject



82
83
84
# File 'lib/celluloid/extras/hash.rb', line 82

def keys
  @outer.keys
end

#merge(h) ⇒ Object



34
35
36
# File 'lib/celluloid/extras/hash.rb', line 34

def merge(h)
  @outer.merge(h)
end

#merge!(h) ⇒ Object



38
39
40
# File 'lib/celluloid/extras/hash.rb', line 38

def merge!(h)
  @outer.merge!(h)
end

#replace(h) ⇒ Object



66
67
68
# File 'lib/celluloid/extras/hash.rb', line 66

def replace(h)
  @outer.replace(h)
end

#select(&b) ⇒ Object



62
63
64
# File 'lib/celluloid/extras/hash.rb', line 62

def select(&b)
  @outer.select(&b)
end

#select!(&b) ⇒ Object



58
59
60
# File 'lib/celluloid/extras/hash.rb', line 58

def select!(&b)
  @outer.select!(&b)
end

#sort_by(&b) ⇒ Object



50
51
52
# File 'lib/celluloid/extras/hash.rb', line 50

def sort_by(&b)
  @outer.sort_by(&b)
end