Module: Basket

Defined in:
lib/basket.rb,
lib/basket/error.rb,
lib/basket/batcher.rb,
lib/basket/element.rb,
lib/basket/version.rb,
lib/basket/handle_add.rb,
lib/basket/configuration.rb,
lib/basket/backend_adapter.rb,
lib/basket/queue_collection.rb,
lib/basket/backend_adapter/redis_backend.rb,
lib/basket/backend_adapter/memory_backend.rb

Defined Under Namespace

Modules: Batcher Classes: BackendAdapter, BasketNotFoundError, Configuration, Element, ElementNotFoundError, EmptyBasketError, Error, HandleAdd, QueueCollection

Constant Summary collapse

VERSION =
"0.0.7"

Class Method Summary collapse

Class Method Details

.add(queue, data) ⇒ Object



39
40
41
# File 'lib/basket.rb', line 39

def self.add(queue, data)
  HandleAdd.call(queue, data)
end

.clear_allObject



51
52
53
# File 'lib/basket.rb', line 51

def self.clear_all
  queue_collection.reset_backend
end

.configObject



19
20
21
# File 'lib/basket.rb', line 19

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



23
24
25
# File 'lib/basket.rb', line 23

def self.configure
  yield(config)
end

.contentsObject



27
28
29
# File 'lib/basket.rb', line 27

def self.contents
  @queue_collection.data
end

.peek(queue) ⇒ Object



31
32
33
# File 'lib/basket.rb', line 31

def self.peek(queue)
  queue_collection.read(queue)
end

.queue_collectionObject



35
36
37
# File 'lib/basket.rb', line 35

def self.queue_collection
  @queue_collection ||= Basket::QueueCollection.new
end

.remove(queue, id) ⇒ Object



47
48
49
# File 'lib/basket.rb', line 47

def self.remove(queue, id)
  queue_collection.remove(queue, id)
end

.search(queue, &query) ⇒ Object



43
44
45
# File 'lib/basket.rb', line 43

def self.search(queue, &query)
  queue_collection.search(queue, query)
end