Class: Vessel::Driver::Mechanize::Page
- Extended by:
- Forwardable
- Defined in:
- lib/vessel/driver/mechanize/page.rb
Instance Attribute Summary collapse
-
#mechanize ⇒ Object
readonly
Returns the value of attribute mechanize.
Instance Method Summary collapse
-
#blacklist= ⇒ Object
rubocop:disable all.
- #close ⇒ Object
- #cookies ⇒ Object
- #cookies=(cookies) ⇒ Object
- #current_url ⇒ Object
- #go_to(url) ⇒ Object
- #headers ⇒ Object
- #headers=(headers) ⇒ Object
-
#initialize(mechanize) ⇒ Page
constructor
A new instance of Page.
-
#page ⇒ Object
rubocop:enable all.
- #size ⇒ Object
- #status ⇒ Object
- #whitelist= ⇒ Object
Methods inherited from Page
Constructor Details
#initialize(mechanize) ⇒ Page
Returns a new instance of Page.
15 16 17 18 |
# File 'lib/vessel/driver/mechanize/page.rb', line 15 def initialize(mechanize) super() @mechanize = mechanize end |
Instance Attribute Details
#mechanize ⇒ Object (readonly)
Returns the value of attribute mechanize.
13 14 15 |
# File 'lib/vessel/driver/mechanize/page.rb', line 13 def mechanize @mechanize end |
Instance Method Details
#blacklist= ⇒ Object
rubocop:disable all
58 59 60 61 62 63 |
# File 'lib/vessel/driver/mechanize/page.rb', line 58 def blacklist=(*) @@_blacklist_warning ||= begin warn "blacklist is not supported by mechanize driver" true end end |
#close ⇒ Object
20 21 22 23 |
# File 'lib/vessel/driver/mechanize/page.rb', line 20 def close mechanize.shutdown @mechanize = nil end |
#cookies ⇒ Object
41 42 43 |
# File 'lib/vessel/driver/mechanize/page.rb', line 41 def mechanize. end |
#cookies=(cookies) ⇒ Object
37 38 39 |
# File 'lib/vessel/driver/mechanize/page.rb', line 37 def () .each { |c| mechanize. << ::Mechanize::Cookie.new(c) } end |
#current_url ⇒ Object
53 54 55 |
# File 'lib/vessel/driver/mechanize/page.rb', line 53 def current_url page&.uri.to_s end |
#go_to(url) ⇒ Object
25 26 27 |
# File 'lib/vessel/driver/mechanize/page.rb', line 25 def go_to(url) mechanize.get(url) end |
#headers ⇒ Object
33 34 35 |
# File 'lib/vessel/driver/mechanize/page.rb', line 33 def headers mechanize.request_headers end |
#headers=(headers) ⇒ Object
29 30 31 |
# File 'lib/vessel/driver/mechanize/page.rb', line 29 def headers=(headers) mechanize.request_headers = headers end |
#page ⇒ Object
rubocop:enable all
73 74 75 |
# File 'lib/vessel/driver/mechanize/page.rb', line 73 def page mechanize.current_page end |
#size ⇒ Object
49 50 51 |
# File 'lib/vessel/driver/mechanize/page.rb', line 49 def size page.content.bytesize end |
#status ⇒ Object
45 46 47 |
# File 'lib/vessel/driver/mechanize/page.rb', line 45 def status page.code.to_i end |
#whitelist= ⇒ Object
65 66 67 68 69 70 |
# File 'lib/vessel/driver/mechanize/page.rb', line 65 def whitelist=(*) @@_whitelist_warning ||= begin warn "whitelist is not supported by mechanize driver" true end end |