Class: Proto::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/proto/scraper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Scraper

Returns a new instance of Scraper.



5
6
7
# File 'lib/proto/scraper.rb', line 5

def initialize(url)
  @doc = Nokogiri::HTML(open(url))
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



3
4
5
# File 'lib/proto/scraper.rb', line 3

def doc
  @doc
end

Instance Method Details

#fetch(name = 'Type', args) ⇒ Object Also known as: fetch_and_create!



9
10
11
12
13
# File 'lib/proto/scraper.rb', line 9

def fetch(name='Type', args)
  attributes = scrape_attribute_data(args)
  protos     = create_return_objects(name, attributes)
  return protos
end