Class: Net::HTTP::Persistent::Connection
- Inherits:
-
Object
- Object
- Net::HTTP::Persistent::Connection
- Defined in:
- lib/net/http/persistent/connection.rb
Overview
A Net::HTTP connection wrapper that holds extra information for managing the connection’s lifetime.
Instance Attribute Summary collapse
-
#http ⇒ Object
:nodoc:.
-
#last_use ⇒ Object
Returns the value of attribute last_use.
-
#requests ⇒ Object
Returns the value of attribute requests.
-
#ssl_generation ⇒ Object
Returns the value of attribute ssl_generation.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(http_class, http_args, ssl_generation) ⇒ Connection
constructor
A new instance of Connection.
- #reset ⇒ Object
- #ressl(ssl_generation) ⇒ Object
Constructor Details
#initialize(http_class, http_args, ssl_generation) ⇒ Connection
Returns a new instance of Connection.
15 16 17 18 19 20 |
# File 'lib/net/http/persistent/connection.rb', line 15 def initialize http_class, http_args, ssl_generation @http = http_class.new(*http_args) @ssl_generation = ssl_generation reset end |
Instance Attribute Details
#http ⇒ Object
:nodoc:
7 8 9 |
# File 'lib/net/http/persistent/connection.rb', line 7 def http @http end |
#last_use ⇒ Object
Returns the value of attribute last_use.
9 10 11 |
# File 'lib/net/http/persistent/connection.rb', line 9 def last_use @last_use end |
#requests ⇒ Object
Returns the value of attribute requests.
11 12 13 |
# File 'lib/net/http/persistent/connection.rb', line 11 def requests @requests end |
#ssl_generation ⇒ Object
Returns the value of attribute ssl_generation.
13 14 15 |
# File 'lib/net/http/persistent/connection.rb', line 13 def ssl_generation @ssl_generation end |
Instance Method Details
#finish ⇒ Object
22 23 24 25 26 27 |
# File 'lib/net/http/persistent/connection.rb', line 22 def finish @http.finish rescue IOError ensure reset end |
#reset ⇒ Object
29 30 31 32 |
# File 'lib/net/http/persistent/connection.rb', line 29 def reset @last_use = Net::HTTP::Persistent::EPOCH @requests = 0 end |
#ressl(ssl_generation) ⇒ Object
34 35 36 37 38 |
# File 'lib/net/http/persistent/connection.rb', line 34 def ressl ssl_generation @ssl_generation = ssl_generation finish end |