Class: Ww::Store

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, MonitorMixin
Defined in:
lib/ww/store.rb

Instance Method Summary collapse

Constructor Details

#initializeStore

Returns a new instance of Store.



12
13
14
15
# File 'lib/ww/store.rb', line 12

def initialize
  super()
  @store = []
end

Instance Method Details

#clear!Object



29
30
31
# File 'lib/ww/store.rb', line 29

def clear!
  synchronize{ @store.clear }
end

#each(descendant = true, &block) ⇒ Object



25
26
27
# File 'lib/ww/store.rb', line 25

def each(descendant = true, &block)
  (descendant ? storage.reverse : storage).each(&block)
end

#storageObject



17
18
19
# File 'lib/ww/store.rb', line 17

def storage
  synchronize { @store.dup }
end

#store(obj) ⇒ Object



21
22
23
# File 'lib/ww/store.rb', line 21

def store(obj)
  synchronize{ @store << obj }
end