Class: Flowhook::Worker
- Inherits:
-
Object
- Object
- Flowhook::Worker
- Defined in:
- lib/flowhook/worker.rb
Overview
The worker to sending webhook
Instance Method Summary collapse
- #daemonize? ⇒ Boolean
-
#initialize(options) ⇒ Worker
constructor
A new instance of Worker.
- #pidfile? ⇒ Boolean
- #start ⇒ Object
Constructor Details
#initialize(options) ⇒ Worker
Returns a new instance of Worker.
4 5 6 7 8 9 |
# File 'lib/flowhook/worker.rb', line 4 def initialize() @options = @pidfile = File.('flowhook.pid') initialize_stream end |
Instance Method Details
#daemonize? ⇒ Boolean
23 24 25 |
# File 'lib/flowhook/worker.rb', line 23 def daemonize? @options.daemonize end |
#pidfile? ⇒ Boolean
27 28 29 |
# File 'lib/flowhook/worker.rb', line 27 def pidfile? !@pidfile.nil? end |
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/flowhook/worker.rb', line 11 def start check_pid daemonize if daemonize? write_pid trap_signals @stream.read do |event| # TODO: Logging response Thread.new { send event } end end |