Class: Capybara::Mechanize::Browser::ResponseProxy
- Inherits:
-
Object
- Object
- Capybara::Mechanize::Browser::ResponseProxy
- Extended by:
- Forwardable
- Defined in:
- lib/capybara/mechanize/browser.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #current_url ⇒ Object
- #headers ⇒ Object
-
#initialize(page) ⇒ ResponseProxy
constructor
A new instance of ResponseProxy.
- #redirect? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(page) ⇒ ResponseProxy
Returns a new instance of ResponseProxy.
266 267 268 |
# File 'lib/capybara/mechanize/browser.rb', line 266 def initialize(page) @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
264 265 266 |
# File 'lib/capybara/mechanize/browser.rb', line 264 def page @page end |
Instance Method Details
#current_url ⇒ Object
270 271 272 |
# File 'lib/capybara/mechanize/browser.rb', line 270 def current_url page.uri.to_s end |
#headers ⇒ Object
274 275 276 277 278 279 |
# File 'lib/capybara/mechanize/browser.rb', line 274 def headers # Hax the content-type contains utf8, so Capybara specs are failing, need to ask mailinglist headers = page.response headers["content-type"].gsub!(';charset=utf-8', '') if headers["content-type"] headers end |
#redirect? ⇒ Boolean
285 286 287 |
# File 'lib/capybara/mechanize/browser.rb', line 285 def redirect? status >= 300 && status < 400 end |
#status ⇒ Object
281 282 283 |
# File 'lib/capybara/mechanize/browser.rb', line 281 def status page.code.to_i end |