Class: Apprentice::Sentinel

Inherits:
Object
  • Object
show all
Includes:
Configuration, Server
Defined in:
lib/apprentice.rb

Instance Method Summary collapse

Methods included from Configuration

#get_config

Constructor Details

#initializeSentinel

Returns a new instance of Sentinel.



11
12
13
# File 'lib/apprentice.rb', line 11

def initialize
  @options = get_config
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/apprentice.rb', line 15

def run
  EM.run do
    Signal.trap('INT') { EventMachine.stop }
    Signal.trap('TERM') { EventMachine.stop }
    EventMachine.start_server(
        @options.ip,
        @options.port,
        Server::EventServer,
        @options
    )
  end
end