class Strum::Server::Handshake
Public Class Methods
new(socket, *stages)
click to toggle source
Create a new Handshake
object @param socket [Async::IO::TCPSocket] the socket this handshake will cycling stages through. @param stages [Array] All stages for this Handshake
.
# File lib/strum/server/handshake.rb, line 15 def initialize(socket, *stages) raise Strum::Errors::NilSocketReceiver unless socket self[:Socket] = socket self[:StageList] = {} stages.each do |stage| self[:StageList][stages.index(stage)] = stage.new(self[:Socket], self) self[:StageList][stages.index(stage)] .register_sibling(stages[stages.index(stage) + 1]) end end
Public Instance Methods
cycle()
click to toggle source
Cycles through the Handshake
stages.
# File lib/strum/server/handshake.rb, line 30 def cycle set_stage(self[:StageList].first) end
set_stage(stage)
click to toggle source
Sets the current stage. @param stage [Stage] the stage we're setting this Handshake
to.
# File lib/strum/server/handshake.rb, line 37 def set_stage(stage) raise Strum::Errors::NilSocketReceiver unless self[:Socket] self[:Stage] = stage.new(self[:Socket], self) self[:Stage].execute end