Class: Push::Daemon::Feedback::FeedbackHandler
- Inherits:
-
Object
- Object
- Push::Daemon::Feedback::FeedbackHandler
- Defined in:
- lib/push/daemon/feedback/feedback_handler.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(processor) ⇒ FeedbackHandler
constructor
A new instance of FeedbackHandler.
- #start ⇒ Object
- #stop ⇒ Object
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
#name ⇒ Object (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
#start ⇒ Object
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 |
#stop ⇒ Object
22 23 24 25 |
# File 'lib/push/daemon/feedback/feedback_handler.rb', line 22 def stop @stop = true @queue.wakeup(@thread) end |