Class: Proto::Scraper
- Inherits:
-
Object
- Object
- Proto::Scraper
- Defined in:
- lib/proto/scraper.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
Instance Method Summary collapse
- #fetch(name = 'Type', args) ⇒ Object (also: #fetch_and_create!)
-
#initialize(url) ⇒ Scraper
constructor
A new instance of Scraper.
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
#doc ⇒ Object
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 |