Class: Sanford::Server::Connection
- Inherits:
-
Object
- Object
- Sanford::Server::Connection
- Defined in:
- lib/sanford/server.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
1
Instance Method Summary collapse
-
#initialize(socket) ⇒ Connection
constructor
A new instance of Connection.
- #read_data ⇒ Object
- #write_data(data) ⇒ Object
Constructor Details
#initialize(socket) ⇒ Connection
Returns a new instance of Connection.
38 39 40 41 |
# File 'lib/sanford/server.rb', line 38 def initialize(socket) @connection = Sanford::Protocol::Connection.new(socket) @timeout = (ENV['SANFORD_TIMEOUT'] || DEFAULT_TIMEOUT).to_f end |
Instance Method Details
#read_data ⇒ Object
43 44 45 |
# File 'lib/sanford/server.rb', line 43 def read_data @connection.read(@timeout) end |
#write_data(data) ⇒ Object
47 48 49 |
# File 'lib/sanford/server.rb', line 47 def write_data(data) @connection.write data end |