Module: RSpec::SidekiqPro::Batches::Props

Defined in:
lib/rspec/sidekiq_pro/batches.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rspec/sidekiq_pro/batches.rb', line 11

def [](key)
  if key.is_a?(Numeric)
    batches_array[key]
  else
    batches_hash[key]
  end
end

.[]=(bid, batch) ⇒ Object



19
20
21
22
23
# File 'lib/rspec/sidekiq_pro/batches.rb', line 19

def []=(bid, batch)
  batch["bid"] = bid
  batches_array << batch
  batches_hash[bid] = batch
end

.clear_allObject



30
31
32
33
# File 'lib/rspec/sidekiq_pro/batches.rb', line 30

def clear_all
  batches_array.clear
  batches_hash.clear
end

.delete(bid) ⇒ Object



25
26
27
28
# File 'lib/rspec/sidekiq_pro/batches.rb', line 25

def delete(bid)
  batch = batches_hash.delete(bid)
  batches_array.delete(batch)
end

.to_aObject



35
36
37
# File 'lib/rspec/sidekiq_pro/batches.rb', line 35

def to_a
  batches_array
end

.to_hObject



39
40
41
# File 'lib/rspec/sidekiq_pro/batches.rb', line 39

def to_h
  batches_hash
end