Class: Parser::Sport
- Inherits:
-
Object
- Object
- Parser::Sport
- Defined in:
- lib/fly_parser/sources/sport.rb
Instance Method Summary collapse
- #current_page ⇒ Object
-
#initialize(source) ⇒ Sport
constructor
A new instance of Sport.
- #parse_all ⇒ Object
- #parse_in(category) ⇒ Object
Constructor Details
Instance Method Details
#current_page ⇒ Object
19 20 21 |
# File 'lib/fly_parser/sources/sport.rb', line 19 def current_page @source.link_with(:text => @category).click end |
#parse_all ⇒ Object
23 24 25 |
# File 'lib/fly_parser/sources/sport.rb', line 23 def parse_all @categories.map { |category| parse_in(category) } end |
#parse_in(category) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/fly_parser/sources/sport.rb', line 9 def parse_in(category) @category = category @current_page = current_page @current_page.search('.anons').map do |news_item| href = news_item.css('a').first.attributes['href'].value item_page = @current_page.link_with(:href => href).click { title: item_page.search('.titleH1').text(), content: item_page.search('.article-textBlock').text() } end end |