Class: Rextract::Spider
- Inherits:
-
Object
- Object
- Rextract::Spider
- Defined in:
- lib/rextract/spider.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Spider
constructor
A new instance of Spider.
Constructor Details
#initialize(opts = {}) ⇒ Spider
Returns a new instance of Spider.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rextract/spider.rb', line 5 def initialize(opts = {}) @agent = Rextract::Browser.new do |a| a.user_agent_alias = opts[:user_agent_alias] || 'Mac Safari' a. = true a.auth(opts[:user], opts[:password]) if opts.has_key?(:user) && opts.has_key?(:password) opts.each do |key, val| method = "#{key}=" a.send(method, val) if a.respond_to?(method) end end end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
4 5 6 |
# File 'lib/rextract/spider.rb', line 4 def agent @agent end |