Class: Autorespawn::Watch

Inherits:
Object
  • Object
show all
Defined in:
lib/autorespawn/watch.rb

Overview

Functionality to watch a program for change

Instance Attribute Summary collapse

Instance Method Summary collapse

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_stateProgramID (readonly)

Returns the reference state.

Returns:



5
6
7
# File 'lib/autorespawn/watch.rb', line 5

def current_state
  @current_state
end

Instance Method Details

#waitObject

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