Class: Basket::HandleAdd

Inherits:
Object
  • Object
show all
Defined in:
lib/basket/handle_add.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue, data) ⇒ HandleAdd

Returns a new instance of HandleAdd.



7
8
9
10
# File 'lib/basket/handle_add.rb', line 7

def initialize(queue, data)
  @queue = queue
  @data = data
end

Class Method Details

.call(queue, data) ⇒ Object



3
4
5
# File 'lib/basket/handle_add.rb', line 3

def self.call(queue, data)
  new(queue, data).call
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'lib/basket/handle_add.rb', line 12

def call
  setup_batchers
  add_to_basket
  perform if basket_full?(@queue_length, @queue_class)
rescue => error
  maybe_raise_basket_error(error)
  failure(error)
end