Module: Sanfrecce
- Defined in:
- lib/sanfrecce.rb,
lib/sanfrecce/version.rb
Overview
sanfrecce
Constant Summary collapse
- VERSION =
"0.1.3"
Class Method Summary collapse
- .all_games ⇒ Object
- .first_ranking ⇒ Object
- .first_stage ⇒ Object
- .players ⇒ Object
- .ranking ⇒ Object
- .second_ranking ⇒ Object
- .second_stage ⇒ Object
Class Method Details
.all_games ⇒ Object
35 36 37 |
# File 'lib/sanfrecce.rb', line 35 def all_games first_stage.merge(second_stage) end |
.first_ranking ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/sanfrecce.rb', line 47 def first_ranking rank = {} fetch_ranking.css('div:nth-child(3) > table > tr').each do |item| rank[html2text(item, 'td:nth-child(1)')] = rank_detail(item) end rank end |
.first_stage ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/sanfrecce.rb', line 19 def first_stage games = {} fetch_games.css('div:nth-child(3) > table > tr').each do |item| games['1st-' + html2text(item, 'td:nth-child(1)')] = game_detail(item) end games.delete_if { |key, _value| key == '1st-' } end |
.players ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sanfrecce.rb', line 8 def players html = fetch_players players = {} html.css('a').each do |item| no = item.css('span.uniform_number').text name = html2text(item, 'span.player_name > strong') players[no] = name end players end |
.ranking ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/sanfrecce.rb', line 39 def ranking rank = {} fetch_ranking.css('div:nth-child(5) > table > tr').each do |item| rank[html2text(item, 'td:nth-child(1)')] = rank_detail(item) end rank end |
.second_ranking ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/sanfrecce.rb', line 55 def second_ranking rank = {} fetch_ranking.css('div:nth-child(4) > table > tr').each do |item| rank[html2text(item, 'td:nth-child(1)')] = rank_detail(item) end rank end |
.second_stage ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sanfrecce.rb', line 27 def second_stage games = {} fetch_games.css('div:nth-child(4) > table > tr').each do |item| games['2nd-' + html2text(item, 'td:nth-child(1)')] = game_detail(item) end games.delete_if { |key, _value| key == '2nd-' } end |