Class: Thronglets::Listener
- Inherits:
-
Object
- Object
- Thronglets::Listener
- Defined in:
- lib/thronglets/listener.rb
Instance Attribute Summary collapse
-
#process ⇒ Object
readonly
Returns the value of attribute process.
Instance Method Summary collapse
-
#initialize ⇒ Listener
constructor
A new instance of Listener.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Listener
Returns a new instance of Listener.
9 10 11 |
# File 'lib/thronglets/listener.rb', line 9 def initialize @process = nil end |
Instance Attribute Details
#process ⇒ Object (readonly)
Returns the value of attribute process.
7 8 9 |
# File 'lib/thronglets/listener.rb', line 7 def process @process end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/thronglets/listener.rb', line 13 def run spawn_process listener = Listen.to("app") do |_modified, _added, _removed| process.stop ensure spawn_process end listener.start sleep rescue Interrupt process.stop # tries increasingly harsher methods to kill the process. end |