Class: Dog::ScheduledTask

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#frequencyObject (readonly)

Returns the value of attribute frequency.



3
4
5
# File 'lib/dog/scheduled_task.rb', line 3

def frequency
  @frequency
end

#titleObject (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