Class: Cline::ScheduledJob

Inherits:
Object
  • Object
show all
Defined in:
lib/cline/scheduled_job.rb

Constant Summary collapse

INTERVAL =
60

Instance Method Summary collapse

Constructor Details

#initialize(trigger, &block) ⇒ ScheduledJob

Returns a new instance of ScheduledJob.



5
6
7
8
# File 'lib/cline/scheduled_job.rb', line 5

def initialize(trigger, &block)
  @trigger = trigger
  @job     = block
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
# File 'lib/cline/scheduled_job.rb', line 10

def run
  loop do
    invoke_if_needed

    sleep INTERVAL
  end
end