Class: Arpie::Endpoint
- Inherits:
-
Object
- Object
- Arpie::Endpoint
- 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
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
-
#initialize(protocol, io) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #read_message ⇒ Object
- #write_message(message) ⇒ Object (also: #<<)
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
#io ⇒ Object (readonly)
Returns the value of attribute io.
8 9 10 |
# File 'lib/arpie/server.rb', line 8 def io @io end |
#protocol ⇒ Object (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_message ⇒ Object
17 18 19 |
# File 'lib/arpie/server.rb', line 17 def @protocol.(@io) end |
#write_message(message) ⇒ Object Also known as: <<
21 22 23 |
# File 'lib/arpie/server.rb', line 21 def @protocol.(@io, ) end |