Class: Messed::EMRunner
- Inherits:
-
Object
- Object
- Messed::EMRunner
- Includes:
- Logger::LoggingModule
- Defined in:
- lib/messed/em_runner.rb
Defined Under Namespace
Classes: StatusHandler
Instance Method Summary collapse
-
#initialize(options, &block) ⇒ EMRunner
constructor
A new instance of EMRunner.
- #quit ⇒ Object
Methods included from Logger::LoggingModule
Constructor Details
#initialize(options, &block) ⇒ EMRunner
Returns a new instance of EMRunner.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/messed/em_runner.rb', line 27 def initialize(, &block) logger.info "Starting..." unless [:supress_banner] if [:detach] pid = EM.fork_reactor do trap("INT") { EM.stop_reactor_loop } EM.run do EM.next_tick(&block) end end Process.detach(pid) exit(0) else EM.run do EM.next_tick(&block) end end end |
Instance Method Details
#quit ⇒ Object
45 46 47 |
# File 'lib/messed/em_runner.rb', line 45 def quit EM.stop; logger.info "\nStoping #{interface.name.to_s}"; exit(0) end |