class Ellen::Cron::Job
Attributes
attributes[R]
thread[R]
Public Class Methods
new(attributes)
click to toggle source
# File lib/ellen/cron/job.rb, line 6 def initialize(attributes) @attributes = attributes.stringify_keys end
Public Instance Methods
body()
click to toggle source
# File lib/ellen/cron/job.rb, line 40 def body attributes["body"] end
description()
click to toggle source
# File lib/ellen/cron/job.rb, line 28 def description %<%5s: "%s" %s> % [id, schedule, body] end
from()
click to toggle source
# File lib/ellen/cron/job.rb, line 44 def from attributes["from"] end
id()
click to toggle source
# File lib/ellen/cron/job.rb, line 32 def id attributes["id"] end
schedule()
click to toggle source
# File lib/ellen/cron/job.rb, line 36 def schedule attributes["schedule"] end
start(robot)
click to toggle source
# File lib/ellen/cron/job.rb, line 10 def start(robot) @thread = Thread.new do Chrono::Trigger.new(schedule) do Message.new( attributes.symbolize_keys.except(:body, :id, :schedule).merge(robot: robot) ).reply(body) end.run end end
stop()
click to toggle source
# File lib/ellen/cron/job.rb, line 24 def stop thread.kill end
to()
click to toggle source
# File lib/ellen/cron/job.rb, line 48 def to attributes["to"] end
to_hash()
click to toggle source
# File lib/ellen/cron/job.rb, line 20 def to_hash attributes end