Class: Pushr::Daemon::FeedbackHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/pushr/daemon/feedback_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processor_path) ⇒ FeedbackHandler

Returns a new instance of FeedbackHandler.



6
7
8
9
# File 'lib/pushr/daemon/feedback_handler.rb', line 6

def initialize(processor_path)
  @name = 'FeedbackHandler'
  @processor_path = processor_path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/pushr/daemon/feedback_handler.rb', line 4

def name
  @name
end

#processorObject (readonly)

Returns the value of attribute processor.



4
5
6
# File 'lib/pushr/daemon/feedback_handler.rb', line 4

def processor
  @processor
end

#processor_pathObject (readonly)

Returns the value of attribute processor_path.



4
5
6
# File 'lib/pushr/daemon/feedback_handler.rb', line 4

def processor_path
  @processor_path
end

Instance Method Details

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pushr/daemon/feedback_handler.rb', line 11

def start
  return unless @processor_path
  require "#{Dir.pwd}/#{@processor_path}"
  @processor = Pushr::FeedbackProcessor.new

  Thread.new do
    loop do
      handle_next
      break if @stop
    end
  end
end

#stopObject



24
25
26
# File 'lib/pushr/daemon/feedback_handler.rb', line 24

def stop
  @stop = true
end