Class: EventScraper
Constant Summary
Constants included from CachedHtml
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize ⇒ EventScraper
constructor
A new instance of EventScraper.
- #parse ⇒ Object
- #parse_test ⇒ Object
Methods included from CachedHtml
#cached_html, #filename, #munge
Constructor Details
#initialize ⇒ EventScraper
Returns a new instance of EventScraper.
8 9 10 |
# File 'lib/event_scraper.rb', line 8 def initialize @doc = Nokogiri::HTML.parse(self.html) end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
6 7 8 |
# File 'lib/event_scraper.rb', line 6 def doc @doc end |
Instance Method Details
#html ⇒ Object
12 13 14 |
# File 'lib/event_scraper.rb', line 12 def html @html ||= cached_html(about[:url]) end |
#parse ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/event_scraper.rb', line 16 def parse @res = [] nodes.map {|n| @res << event(n) } @res end |
#parse_test ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/event_scraper.rb', line 24 def parse_test nodes.each {|n| puts n.inner_html puts n.inner_text.gsub(/\s{2,}/, ' ').strip puts '-' * 80 } end |