Class: Arpie::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/arpie/server.rb

Overview

Endpoint wraps client IO objects. One Endpoint per client. This is provided as a convenience mechanism for protocols to store protocol-and-client-specific data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol, io) ⇒ Endpoint

Returns a new instance of Endpoint.



12
13
14
15
# File 'lib/arpie/server.rb', line 12

def initialize protocol, io
  @protocol, @io = protocol, io
  @protocol.reset
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



8
9
10
# File 'lib/arpie/server.rb', line 8

def io
  @io
end

#protocolObject (readonly)

Returns the value of attribute protocol.



10
11
12
# File 'lib/arpie/server.rb', line 10

def protocol
  @protocol
end

Instance Method Details

#read_messageObject



17
18
19
# File 'lib/arpie/server.rb', line 17

def read_message
  @protocol.read_message(@io)
end

#write_message(message) ⇒ Object Also known as: <<



21
22
23
# File 'lib/arpie/server.rb', line 21

def write_message message
  @protocol.write_message(@io, message)
end