Class: Hireling::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/hireling/hireling.rb

Instance Method Summary collapse

Constructor Details

#initializeSchedule

Returns a new instance of Schedule.



49
50
51
# File 'lib/hireling/hireling.rb', line 49

def initialize
  @proxies = {}
end

Instance Method Details

#[](hireling_name) ⇒ Object



52
53
54
# File 'lib/hireling/hireling.rb', line 52

def [](hireling_name)
  @proxies[hireling_name] = SchedulerProxy.new
end

#schedule(rufus_scheduler, hireling) ⇒ Object



56
57
58
59
60
# File 'lib/hireling/hireling.rb', line 56

def schedule(rufus_scheduler, hireling)
  proxy = @proxies[hireling.class.name.underscore.to_sym]
  raise "No schedule found for #{hireling.class.name.underscore.to_sym}" unless proxy
  proxy.replay(rufus_scheduler,hireling)
end