Class: GQTP::Backend::Coolio::Client
- Inherits:
-
Object
- Object
- GQTP::Backend::Coolio::Client
- Defined in:
- lib/gqtp/backend/coolio.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#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, &block) ⇒ Object
- #write(*chunks, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
87 88 89 90 91 92 93 94 |
# File 'lib/gqtp/backend/coolio.rb', line 87 def initialize(={}) @options = @host = [:host] || "127.0.0.1" @port = [:port] || 10043 @loop = [:loop] || ::Coolio::Loop.default @socket = Socket.connect(@host, @port) @socket.attach(@loop) end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
86 87 88 |
# File 'lib/gqtp/backend/coolio.rb', line 86 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
86 87 88 |
# File 'lib/gqtp/backend/coolio.rb', line 86 def port @port end |
Instance Method Details
#close ⇒ Object
104 105 106 |
# File 'lib/gqtp/backend/coolio.rb', line 104 def close @socket.close end |
#read(size, &block) ⇒ Object
100 101 102 |
# File 'lib/gqtp/backend/coolio.rb', line 100 def read(size, &block) @socket.read(size, &block) end |
#write(*chunks, &block) ⇒ Object
96 97 98 |
# File 'lib/gqtp/backend/coolio.rb', line 96 def write(*chunks, &block) @socket.write(*chunks, &block) end |