Class: Undead::Agent
- Inherits:
-
Object
- Object
- Undead::Agent
- Defined in:
- lib/undead/agent.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ js_errors: false, timeout: 1000, }
Instance Method Summary collapse
- #get(url) ⇒ Object
-
#initialize(options = {}) ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize(options = {}) ⇒ Agent
14 15 16 17 18 19 20 |
# File 'lib/undead/agent.rb', line 14 def initialize( = {}) .register_driver :poltergeist do |app| ::Poltergeist::Driver.new(app, DEFAULT_OPTIONS.merge()) end @session = ::Session.new(:poltergeist) @session.driver.headers = { 'User-Agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X)" } end |
Instance Method Details
#get(url) ⇒ Object
22 23 24 25 |
# File 'lib/undead/agent.rb', line 22 def get(url) @session.visit url @session.html end |