Class: Dog::ScheduledTask
- Inherits:
-
Object
- Object
- Dog::ScheduledTask
- Defined in:
- lib/dog/scheduled_task.rb
Instance Attribute Summary collapse
-
#frequency ⇒ Object
readonly
Returns the value of attribute frequency.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #action(&block) ⇒ Object
- #every(frequency) ⇒ Object
-
#initialize(title) ⇒ ScheduledTask
constructor
A new instance of ScheduledTask.
- #run(context) ⇒ Object
Constructor Details
#initialize(title) ⇒ ScheduledTask
Returns a new instance of ScheduledTask.
5 6 7 |
# File 'lib/dog/scheduled_task.rb', line 5 def initialize(title) @title = title end |
Instance Attribute Details
#frequency ⇒ Object (readonly)
Returns the value of attribute frequency.
3 4 5 |
# File 'lib/dog/scheduled_task.rb', line 3 def frequency @frequency end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/dog/scheduled_task.rb', line 3 def title @title end |
Instance Method Details
#action(&block) ⇒ Object
13 14 15 |
# File 'lib/dog/scheduled_task.rb', line 13 def action(&block) @action = block end |
#every(frequency) ⇒ Object
9 10 11 |
# File 'lib/dog/scheduled_task.rb', line 9 def every(frequency) @frequency = frequency end |
#run(context) ⇒ Object
17 18 19 |
# File 'lib/dog/scheduled_task.rb', line 17 def run(context) @action.call(context) end |