Class: Itinerary::ScrapeBriar

Inherits:
Tool
  • Object
show all
Defined in:
lib/itinerary/tools/scrape-briar.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tool

find_tool, inherited, #initialize, tools

Constructor Details

This class inherits a constructor from Itinerary::Tool

Class Method Details

.nameObject



4
5
6
# File 'lib/itinerary/tools/scrape-briar.rb', line 4

def self.name
  'scrape-briar'
end

Instance Method Details

#parse(args) ⇒ Object



8
9
10
# File 'lib/itinerary/tools/scrape-briar.rb', line 8

def parse(args)
  @states = args
end

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/itinerary/tools/scrape-briar.rb', line 12

def run
  scraper = BriarScraper.new
  @states.each do |state|
    recs = scraper.scrape_state(state)
    ;;puts "Scraped #{recs.length} recs from state #{state.inspect}"
    recs.each do |rec|
      @itinerary << rec
      ;;puts rec.to_text
      #FIXME: save
    end
  end
end