Class: Push::Daemon::Feedback::FeedbackHandler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processor) ⇒ FeedbackHandler

Returns a new instance of FeedbackHandler.



7
8
9
10
11
# File 'lib/push/daemon/feedback/feedback_handler.rb', line 7

def initialize(processor)
  @name = "FeedbackHandler"
  @queue = Push::Daemon::Feedback.queue
  require processor
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/push/daemon/feedback/feedback_handler.rb', line 5

def name
  @name
end

Instance Method Details

#startObject



13
14
15
16
17
18
19
20
# File 'lib/push/daemon/feedback/feedback_handler.rb', line 13

def start
  @thread = Thread.new do
    loop do
      break if @stop
      handle_next_feedback
    end
  end
end

#stopObject



22
23
24
25
# File 'lib/push/daemon/feedback/feedback_handler.rb', line 22

def stop
  @stop = true
  @queue.wakeup(@thread)
end