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
- #[](key) ⇒ Object
- #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.
142 143 144 |
# File 'lib/capybara/mechanize/browser.rb', line 142 def initialize(page) @page = page end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
140 141 142 |
# File 'lib/capybara/mechanize/browser.rb', line 140 def page @page end |
Instance Method Details
#[](key) ⇒ Object
157 158 159 |
# File 'lib/capybara/mechanize/browser.rb', line 157 def [](key) headers[key] end |
#current_url ⇒ Object
146 147 148 |
# File 'lib/capybara/mechanize/browser.rb', line 146 def current_url page.uri.to_s end |
#headers ⇒ Object
150 151 152 153 154 155 |
# File 'lib/capybara/mechanize/browser.rb', line 150 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
165 166 167 |
# File 'lib/capybara/mechanize/browser.rb', line 165 def redirect? status >= 300 && status < 400 end |
#status ⇒ Object
161 162 163 |
# File 'lib/capybara/mechanize/browser.rb', line 161 def status page.code.to_i end |