class RSocks::StateMachine
Attributes
current_state[R]
Public Class Methods
new()
click to toggle source
# File lib/r_socks/state_machine.rb, line 9 def initialize @max = 3 @state_num = 0 @current_state = RSocks::STATE_LIST[@state_num] end
Public Instance Methods
auth!()
click to toggle source
# File lib/r_socks/state_machine.rb, line 31 def auth! @state_num = 1 @current_state = RSocks::STATE_LIST[@state_num] end
auth?()
click to toggle source
# File lib/r_socks/state_machine.rb, line 19 def auth? current_state == :auth end
connect!()
click to toggle source
# File lib/r_socks/state_machine.rb, line 36 def connect! @state_num = 2 @current_state = RSocks::STATE_LIST[@state_num] end
connect?()
click to toggle source
# File lib/r_socks/state_machine.rb, line 23 def connect? current_state == :connect end
handshake?()
click to toggle source
# File lib/r_socks/state_machine.rb, line 15 def handshake? current_state == :handshake end
start!()
click to toggle source
# File lib/r_socks/state_machine.rb, line 41 def start! @state_num = 3 @current_state = RSocks::STATE_LIST[@state_num] end
start?()
click to toggle source
# File lib/r_socks/state_machine.rb, line 27 def start? current_state == :start end
state_changed()
click to toggle source
# File lib/r_socks/state_machine.rb, line 46 def state_changed @state_num += 1 unless @state_num >= @max @current_state = RSocks::STATE_LIST[@state_num] end