Class: HTTY::Session
- Inherits:
-
Object
- Object
- HTTY::Session
- Defined in:
- lib/htty/session.rb
Overview
Encapsulates an htty session.
Instance Attribute Summary collapse
-
#requests ⇒ Object
readonly
Returns the requests made during the session.
Instance Method Summary collapse
-
#initialize(address) ⇒ Session
constructor
Initializes a new HTTY::Session with specified address for the first of the session’s #requests.
-
#last_response ⇒ Object
Walks #requests and returns its last HTTY::Response.
Constructor Details
Instance Attribute Details
#requests ⇒ Object (readonly)
Returns the requests made during the session.
7 8 9 |
# File 'lib/htty/session.rb', line 7 def requests @requests end |
Instance Method Details
#last_response ⇒ Object
Walks #requests and returns its last HTTY::Response.
16 17 18 19 20 21 22 23 |
# File 'lib/htty/session.rb', line 16 def last_response last_request_with_response = requests.reverse.detect do |r| r.response end return nil unless last_request_with_response last_request_with_response.response end |