Class: ChronoTrigger::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/chrono_trigger/process.rb

Instance Method Summary collapse

Instance Method Details

#run(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chrono_trigger/process.rb', line 5

def run(options={})
  @t = Thread.new do
    setup(options)
    
    shell = ChronoTrigger::Shell.new
    shell.load_triggers(options[:trigger_files].split(":"))
    loop do
      shell.execute_triggers
      sleep 1.minute.to_i
    end
  end
  
  @t.join
end

#stopObject



20
21
22
# File 'lib/chrono_trigger/process.rb', line 20

def stop
  @t.exit
end