Class: AbstractServer
- Inherits:
-
Object
- Object
- AbstractServer
- Defined in:
- lib/thrift_client/abstract_server.rb
Overview
abstract thrift server information encapsulation
hold client connection
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #destroy ⇒ Object
- #disconnect(client) ⇒ Object
-
#initialize(connect_string, options = {}) ⇒ AbstractServer
constructor
A new instance of AbstractServer.
- #to_s ⇒ Object
Constructor Details
#initialize(connect_string, options = {}) ⇒ AbstractServer
Returns a new instance of AbstractServer.
9 10 11 12 13 14 |
# File 'lib/thrift_client/abstract_server.rb', line 9 def initialize(connect_string, = {}) @host, @port = parse_connect_string(connect_string) @options = @test_on_borrow = @options[:test_on_borrow] @test_on_return = @options[:test_on_return] end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/thrift_client/abstract_server.rb', line 7 def client @client end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/thrift_client/abstract_server.rb', line 7 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/thrift_client/abstract_server.rb', line 7 def port @port end |
Instance Method Details
#active? ⇒ Boolean
16 17 18 |
# File 'lib/thrift_client/abstract_server.rb', line 16 def active? raise NotImplementedError end |
#destroy ⇒ Object
20 21 22 |
# File 'lib/thrift_client/abstract_server.rb', line 20 def destroy raise NotImplementedError end |
#disconnect(client) ⇒ Object
24 25 26 |
# File 'lib/thrift_client/abstract_server.rb', line 24 def disconnect(client) client.close if client end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/thrift_client/abstract_server.rb', line 28 def to_s "#{host}:#{port}" end |