Class: Thin::Backends::SwiftiplyClient
- Defined in:
- lib/thin/backends/swiftiply_client.rb
Overview
Backend to act as a Swiftiply client (swiftiply.swiftcore.org).
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#key ⇒ Object
Returns the value of attribute key.
-
#port ⇒ Object
Returns the value of attribute port.
Attributes inherited from Base
#maximum_connections, #maximum_persistent_connections, #no_epoll, #persistent_connection_count, #server, #ssl, #ssl_options, #threaded, #timeout
Instance Method Summary collapse
-
#connect ⇒ Object
Connect the server.
-
#disconnect ⇒ Object
Stops the server.
-
#initialize(host, port, options = {}) ⇒ SwiftiplyClient
constructor
A new instance of SwiftiplyClient.
- #to_s ⇒ Object
Methods inherited from Base
#close, #config, #connection_finished, #empty?, #running?, #size, #ssl?, #start, #stop, #stop!, #threaded?
Constructor Details
#initialize(host, port, options = {}) ⇒ SwiftiplyClient
Returns a new instance of SwiftiplyClient.
9 10 11 12 13 14 |
# File 'lib/thin/backends/swiftiply_client.rb', line 9 def initialize(host, port, ={}) @host = host @port = port.to_i @key = [:swiftiply].to_s super() end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/thin/backends/swiftiply_client.rb', line 7 def host @host end |
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/thin/backends/swiftiply_client.rb', line 5 def key @key end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/thin/backends/swiftiply_client.rb', line 7 def port @port end |
Instance Method Details
#connect ⇒ Object
Connect the server
17 18 19 |
# File 'lib/thin/backends/swiftiply_client.rb', line 17 def connect EventMachine.connect(@host, @port, SwiftiplyConnection, &method(:initialize_connection)) end |
#disconnect ⇒ Object
Stops the server
22 23 24 |
# File 'lib/thin/backends/swiftiply_client.rb', line 22 def disconnect EventMachine.stop end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/thin/backends/swiftiply_client.rb', line 26 def to_s "#{@host}:#{@port} swiftiply" end |