Class: Todoable::UI::JobQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/todoable/ui/gtk/jobqueue.rb

Instance Method Summary collapse

Constructor Details

#initializeJobQueue

Returns a new instance of JobQueue



16
17
18
19
# File 'lib/todoable/ui/gtk/jobqueue.rb', line 16

def initialize
  @queue = Queue.new
  @worker_id = nil
end

Instance Method Details

#push(&job) ⇒ Object



21
22
23
24
25
26
# File 'lib/todoable/ui/gtk/jobqueue.rb', line 21

def push(&job)
  @queue << job
  if @worker_id.nil?
    start_worker
  end
end

#stopObject



28
29
30
31
32
# File 'lib/todoable/ui/gtk/jobqueue.rb', line 28

def stop
  return if @worker_id.nil?
  GLib::Source.remove(@worker_id)
  @worker_id = nil
end