Class: GQTP::Connection::Synchronous::Client
- Inherits:
-
Object
- Object
- GQTP::Connection::Synchronous::Client
- Defined in:
- lib/gqtp/connection/synchronous.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #read(size = nil, &block) ⇒ Object
- #write(*chunks, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
62 63 64 65 66 67 68 |
# File 'lib/gqtp/connection/synchronous.rb', line 62 def initialize(={}) @options = @address = [:address] || "127.0.0.1" @port = [:port] || 10041 @socket = TCPSocket.open(@address, @port) @io = IO.new(@socket) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
61 62 63 |
# File 'lib/gqtp/connection/synchronous.rb', line 61 def address @address end |
#port ⇒ Object
Returns the value of attribute port.
61 62 63 |
# File 'lib/gqtp/connection/synchronous.rb', line 61 def port @port end |
Instance Method Details
#close ⇒ Object
78 79 80 |
# File 'lib/gqtp/connection/synchronous.rb', line 78 def close @io.close end |
#read(size = nil, &block) ⇒ Object
74 75 76 |
# File 'lib/gqtp/connection/synchronous.rb', line 74 def read(size=nil, &block) @io.read(size, &block) end |
#write(*chunks, &block) ⇒ Object
70 71 72 |
# File 'lib/gqtp/connection/synchronous.rb', line 70 def write(*chunks, &block) @io.write(*chunks, &block) end |