Module: Sidetiq::Batching::Web

Defined in:
lib/sidekiq/batching/web.rb

Constant Summary collapse

VIEWS =
File.expand_path('views', File.dirname(__FILE__))

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sidekiq/batching/web.rb', line 8

def self.registered(app)
  app.get "/batching" do
    @batches = Sidekiq::Batching::Batch.all
    erb File.read(File.join(VIEWS, 'index.erb')), locals: {view_path: VIEWS}
  end

  app.post "/batching/:name/delete" do
    worker_class, queue = Sidekiq::Batching::Batch.extract_worker_klass_and_queue(params['name'])
    batch = Sidekiq::Batching::Batch.new(worker_class, queue)
    batch.delete
    redirect "#{root_path}/batching"
  end
end