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.
6 7 8 9 10 11 |
# File 'lib/flowhook/worker.rb', line 6 def initialize() @options = @pidfile = File.('flowhook.pid') initialize_stream end |
Instance Method Details
#daemonize? ⇒ Boolean
25 26 27 |
# File 'lib/flowhook/worker.rb', line 25 def daemonize? @options.daemonize end |
#pidfile? ⇒ Boolean
29 30 31 |
# File 'lib/flowhook/worker.rb', line 29 def pidfile? !@pidfile.nil? end |
#start ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/flowhook/worker.rb', line 13 def start check_pid daemonize if daemonize? write_pid trap_signals @stream.read do |event| # TODO: Logging response Thread.new { send event } end end |