Class: InternetScrabbleClub::Client::Middleware::Response::Read

Inherits:
Object
  • Object
show all
Defined in:
lib/internet_scrabble_club/client/middleware/response/read.rb

Instance Method Summary collapse

Constructor Details

#initialize(stack, socket) ⇒ Read

Returns a new instance of Read.



7
8
9
# File 'lib/internet_scrabble_club/client/middleware/response/read.rb', line 7

def initialize(stack, socket)
  @stack, @socket = stack, socket
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
# File 'lib/internet_scrabble_club/client/middleware/response/read.rb', line 11

def call(env)
  response_length = @socket.getc.ord * 256 + @socket.getc.ord
  env[:response] = @socket.read(response_length)
  @stack.call(env)
end