Class: Ferrum::Network::Exchange
- Inherits:
-
Object
- Object
- Ferrum::Network::Exchange
- Defined in:
- lib/ferrum/network/exchange.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#intercepted_request ⇒ Object
Returns the value of attribute intercepted_request.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #blocked? ⇒ Boolean
- #finished? ⇒ Boolean
-
#initialize(page, id) ⇒ Exchange
constructor
A new instance of Exchange.
- #inspect ⇒ Object
- #navigation_request?(frame_id) ⇒ Boolean
- #pending? ⇒ Boolean
- #to_a ⇒ Object
Constructor Details
#initialize(page, id) ⇒ Exchange
Returns a new instance of Exchange.
10 11 12 13 14 |
# File 'lib/ferrum/network/exchange.rb', line 10 def initialize(page, id) @page, @id = page, id @intercepted_request = nil @request = @response = @error = nil end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
8 9 10 |
# File 'lib/ferrum/network/exchange.rb', line 8 def error @error end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/ferrum/network/exchange.rb', line 6 def id @id end |
#intercepted_request ⇒ Object
Returns the value of attribute intercepted_request.
7 8 9 |
# File 'lib/ferrum/network/exchange.rb', line 7 def intercepted_request @intercepted_request end |
#request ⇒ Object
Returns the value of attribute request.
8 9 10 |
# File 'lib/ferrum/network/exchange.rb', line 8 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/ferrum/network/exchange.rb', line 8 def response @response end |
Instance Method Details
#blank? ⇒ Boolean
21 22 23 |
# File 'lib/ferrum/network/exchange.rb', line 21 def blank? !request end |
#blocked? ⇒ Boolean
25 26 27 |
# File 'lib/ferrum/network/exchange.rb', line 25 def blocked? intercepted_request && intercepted_request.status?(:aborted) end |
#finished? ⇒ Boolean
29 30 31 |
# File 'lib/ferrum/network/exchange.rb', line 29 def finished? blocked? || response || error end |
#inspect ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/ferrum/network/exchange.rb', line 41 def inspect "#<#{self.class} "\ "@id=#{@id.inspect} "\ "@intercepted_request=#{@intercepted_request.inspect} "\ "@request=#{@request.inspect} "\ "@response=#{@response.inspect} "\ "@error=#{@error.inspect}>" end |
#navigation_request?(frame_id) ⇒ Boolean
16 17 18 19 |
# File 'lib/ferrum/network/exchange.rb', line 16 def (frame_id) request.type?(:document) && request.frame_id == frame_id end |
#pending? ⇒ Boolean
33 34 35 |
# File 'lib/ferrum/network/exchange.rb', line 33 def pending? !finished? end |
#to_a ⇒ Object
37 38 39 |
# File 'lib/ferrum/network/exchange.rb', line 37 def to_a [request, response, error] end |