Module: RSMP::Proxy::Modules::State

Included in:
RSMP::Proxy
Defined in:
lib/rsmp/proxy/modules/state.rb

Overview

State management helpers Utility methods for waiting on state changes

Instance Method Summary collapse

Instance Method Details

#handshake_completeObject



19
20
21
# File 'lib/rsmp/proxy/modules/state.rb', line 19

def handshake_complete
  self.state = :ready
end

#wait_for_state(state, timeout:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rsmp/proxy/modules/state.rb', line 7

def wait_for_state(state, timeout:)
  states = [state].flatten
  return true if states.include?(@state)

  wait_for_condition(@state_condition, timeout: timeout) do
    states.include?(@state)
  end
  true
rescue RSMP::TimeoutError
  raise RSMP::TimeoutError, "Did not reach state #{state} within #{timeout}s"
end