Class: Ellen::Handlers::Cron
- Inherits:
-
Base
- Object
- Base
- Ellen::Handlers::Cron
- Defined in:
- lib/ellen/handlers/cron.rb
Constant Summary collapse
- NAMESPACE =
"cron"
Instance Attribute Summary collapse
-
#jobs ⇒ Object
writeonly
Sets the attribute jobs.
Instance Method Summary collapse
- #add(message) ⇒ Object
- #delete(message) ⇒ Object
-
#initialize(*args) ⇒ Cron
constructor
A new instance of Cron.
- #list(message) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Cron
Returns a new instance of Cron.
14 15 16 17 |
# File 'lib/ellen/handlers/cron.rb', line 14 def initialize(*args) super remember end |
Instance Attribute Details
#jobs=(value) ⇒ Object
Sets the attribute jobs
12 13 14 |
# File 'lib/ellen/handlers/cron.rb', line 12 def jobs=(value) @jobs = value end |
Instance Method Details
#add(message) ⇒ Object
19 20 21 22 |
# File 'lib/ellen/handlers/cron.rb', line 19 def add() job = create() .reply("Job #{job.id} created") end |
#delete(message) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ellen/handlers/cron.rb', line 24 def delete() id = [:id].to_i if jobs.has_key?(id) jobs.delete(id) running_jobs[id].stop running_jobs.delete(id) .reply("Job #{id} deleted") else .reply("Job #{id} does not exist") end end |
#list(message) ⇒ Object
36 37 38 |
# File 'lib/ellen/handlers/cron.rb', line 36 def list() .reply(summary, code: true) end |