Class: Pallets::Scheduler
- Inherits:
-
Object
- Object
- Pallets::Scheduler
- Defined in:
- lib/pallets/scheduler.rb
Instance Method Summary collapse
- #debug ⇒ Object
- #id ⇒ Object
-
#initialize(manager) ⇒ Scheduler
constructor
A new instance of Scheduler.
- #needs_to_stop? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(manager) ⇒ Scheduler
Returns a new instance of Scheduler.
3 4 5 6 7 |
# File 'lib/pallets/scheduler.rb', line 3 def initialize(manager) @manager = manager @needs_to_stop = false @thread = nil end |
Instance Method Details
#debug ⇒ Object
24 25 26 |
# File 'lib/pallets/scheduler.rb', line 24 def debug @thread.backtrace end |
#id ⇒ Object
28 29 30 |
# File 'lib/pallets/scheduler.rb', line 28 def id "S#{@thread.object_id.to_s(36)}".upcase if @thread end |
#needs_to_stop? ⇒ Boolean
20 21 22 |
# File 'lib/pallets/scheduler.rb', line 20 def needs_to_stop? @needs_to_stop end |
#shutdown ⇒ Object
13 14 15 16 17 18 |
# File 'lib/pallets/scheduler.rb', line 13 def shutdown @needs_to_stop = true return unless @thread @thread.join end |
#start ⇒ Object
9 10 11 |
# File 'lib/pallets/scheduler.rb', line 9 def start @thread ||= Thread.new { work } end |