class AmazonDeets::MechanizedScraper

Attributes

agent[RW]
fragments[RW]

Public Class Methods

new(agent: Mechanize.new, fragments: Array.new) click to toggle source
# File lib/amazon_deets/core.rb, line 25
def initialize(agent: Mechanize.new, fragments: Array.new)
  @agent     = agent
  @fragments = fragments
end

Public Instance Methods

scrape(url) click to toggle source
# File lib/amazon_deets/core.rb, line 30
def scrape(url)
  agent.get(url)
  fragments.each do |f|
    if f.applicable?(agent)
      return f.scrape(agent)
    end
  end
end