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, current_fragment: nil) ⇒ ResponseProxy
constructor
A new instance of ResponseProxy.
- #redirect? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(page, current_fragment: nil) ⇒ ResponseProxy
Returns a new instance of ResponseProxy.
172 173 174 175 |
# File 'lib/capybara/mechanize/browser.rb', line 172 def initialize(page, current_fragment: nil) @page = page @current_fragment = current_fragment end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
170 171 172 |
# File 'lib/capybara/mechanize/browser.rb', line 170 def page @page end |
Instance Method Details
#[](key) ⇒ Object
190 191 192 |
# File 'lib/capybara/mechanize/browser.rb', line 190 def [](key) headers[key] end |
#current_url ⇒ Object
177 178 179 180 181 |
# File 'lib/capybara/mechanize/browser.rb', line 177 def current_url uri = page.uri.dup uri.fragment = @current_fragment if @current_fragment uri.to_s end |
#headers ⇒ Object
183 184 185 186 187 188 |
# File 'lib/capybara/mechanize/browser.rb', line 183 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', '') headers end |
#redirect? ⇒ Boolean
198 199 200 |
# File 'lib/capybara/mechanize/browser.rb', line 198 def redirect? status >= 300 && status < 400 end |
#status ⇒ Object
194 195 196 |
# File 'lib/capybara/mechanize/browser.rb', line 194 def status page.code.to_i end |