Class: Celluloid::IO::RackSocket

Inherits:
Stream
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/celluloid/io/rack_socket.rb

Overview

Wraps a socket as gotten from the Rack hijack API

Instance Method Summary collapse

Constructor Details

#initialize(socket) ⇒ RackSocket

Returns a new instance of RackSocket.



12
13
14
15
# File 'lib/celluloid/io/rack_socket.rb', line 12

def initialize(socket)
	super()
	@socket = socket
end

Instance Method Details

#recv(maxlen, flags = nil) ⇒ Object

Receives a message

Raises:

  • (NotImplementedError)


22
23
24
25
# File 'lib/celluloid/io/rack_socket.rb', line 22

def recv(maxlen, flags=nil)
	raise NotImplementedError, "flags not supported" if flags && !flags.zero?
	readpartial(maxlen)
end

#send(msg, flags, dest_sockaddr = nil) ⇒ Object

Send a message

Raises:

  • (NotImplementedError)


28
29
30
31
32
# File 'lib/celluloid/io/rack_socket.rb', line 28

def send(msg, flags, dest_sockaddr = nil)
	raise NotImplementedError, "dest_sockaddr not supported" if dest_sockaddr
	raise NotImplementedError, "flags not supported" unless flags.zero?
	write(msg)
end

#to_ioObject



17
18
19
# File 'lib/celluloid/io/rack_socket.rb', line 17

def to_io
	@socket
end