Class: Autorespawn::Watch
- Inherits:
-
Object
- Object
- Autorespawn::Watch
- Defined in:
- lib/autorespawn/watch.rb
Overview
Functionality to watch a program for change
Instance Attribute Summary collapse
-
#current_state ⇒ ProgramID
readonly
The reference state.
Instance Method Summary collapse
-
#initialize(current_state) ⇒ Watch
constructor
A new instance of Watch.
-
#wait ⇒ Object
Wait for changes.
Constructor Details
#initialize(current_state) ⇒ Watch
Returns a new instance of Watch.
7 8 9 |
# File 'lib/autorespawn/watch.rb', line 7 def initialize(current_state) @current_state = current_state end |
Instance Attribute Details
#current_state ⇒ ProgramID (readonly)
Returns the reference state.
5 6 7 |
# File 'lib/autorespawn/watch.rb', line 5 def current_state @current_state end |
Instance Method Details
#wait ⇒ Object
Wait for changes
12 13 14 15 16 17 18 19 |
# File 'lib/autorespawn/watch.rb', line 12 def wait loop do if current_state.changed? return end sleep 1 end end |