Class: Whenever::WebJob
- Inherits:
-
Object
- Object
- Whenever::WebJob
- Includes:
- ActionView::Helpers::DateHelper
- Defined in:
- app/models/whenever/web_job.rb
Instance Attribute Summary collapse
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Instance Method Summary collapse
- #command ⇒ Object
- #description ⇒ Object
-
#initialize(job, interval) ⇒ WebJob
constructor
A new instance of WebJob.
Constructor Details
#initialize(job, interval) ⇒ WebJob
Returns a new instance of WebJob.
8 9 10 11 |
# File 'app/models/whenever/web_job.rb', line 8 def initialize job, interval @job = job @interval = interval end |
Instance Attribute Details
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
6 7 8 |
# File 'app/models/whenever/web_job.rb', line 6 def interval @interval end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
6 7 8 |
# File 'app/models/whenever/web_job.rb', line 6 def job @job end |
Instance Method Details
#command ⇒ Object
19 20 21 22 |
# File 'app/models/whenever/web_job.rb', line 19 def command replacements = @job..map{ |k, v| [":#{k}", v] }.to_h @job.template.gsub(/:\w+/, replacements) end |
#description ⇒ Object
13 14 15 16 17 |
# File 'app/models/whenever/web_job.rb', line 13 def description @job..fetch(:description) { @job.[:task] } end |