Class: Todoable::UI::JobQueue
- Inherits:
-
Object
- Object
- Todoable::UI::JobQueue
- Defined in:
- lib/todoable/ui/gtk/jobqueue.rb
Instance Method Summary collapse
-
#initialize ⇒ JobQueue
constructor
A new instance of JobQueue.
- #push(&job) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize ⇒ JobQueue
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 |
#stop ⇒ Object
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 |