soccer-quiz 0.1.7 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/quiz +0 -10
- data/lib/quiz/cli.rb +7 -3
- data/lib/quiz/scraper.rb +15 -10
- data/lib/quiz/version.rb +1 -1
- data/soccer-quiz-0.2.1.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b545d394c53f35ee35d2a74220fbe15573c82ffa186ed52f38d2d98adfee139
|
4
|
+
data.tar.gz: 02b811afe34cbb3c7a3b81483acf442d00fce359f4f0ae50fa22bb28bc8f4235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b69793579c3d20ade59556c97dd8a48dcdb718f5d3ad46d74aa365016e5a95c504bb0f50fd09bfc20e09ff1ef57babd2765a82309da70c57c1734b9025ea07
|
7
|
+
data.tar.gz: 249bea93e60380e250f8110cb2e4bcf97ab36af1d9db58fd140fbeba4a4279ae0ceb2e62e36aae97ea07a9d81aa9b76da65dc0c49047d6bc93e2061b894e536e
|
data/Gemfile.lock
CHANGED
data/bin/quiz
CHANGED
@@ -1,12 +1,2 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'quiz' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
1
|
require_relative '../lib/quiz'
|
12
2
|
Quiz::CLI.new.call
|
data/lib/quiz/cli.rb
CHANGED
@@ -64,7 +64,7 @@ class Quiz::CLI
|
|
64
64
|
instace_for_answers = objects.select{|item|item.year == random_year}
|
65
65
|
|
66
66
|
answer_for_how_many = objects.select{|item|item.winner == random_winner}.size
|
67
|
-
|
67
|
+
answer_for_how_many
|
68
68
|
winner = instace_for_answers[0].winner
|
69
69
|
|
70
70
|
host = instace_for_answers[0].host
|
@@ -97,8 +97,8 @@ class Quiz::CLI
|
|
97
97
|
"Who was the host in #{year} world cup?",
|
98
98
|
"#{team} won the World cup final in #{year}. Who was the runner-up?",
|
99
99
|
"How many world cup #{team} has won?",
|
100
|
-
"Who won the champion
|
101
|
-
"#{team} won the Champion
|
100
|
+
"Who won the champion league in #{year}?",
|
101
|
+
"#{team} won the Champion league final in #{year}. Who was the runner-up?",
|
102
102
|
"Who hosted champion league final in #{year}?",
|
103
103
|
"Who won the balon d'Or in #{year}?",
|
104
104
|
"How many balon de'or #{team} has won?",
|
@@ -137,6 +137,10 @@ class Quiz::CLI
|
|
137
137
|
else puts "Sorry you failed. you score #{points} of 10 points."
|
138
138
|
end
|
139
139
|
Quiz::CLI.clear
|
140
|
+
Quiz::CHAMPIONLEAGUE.all.clear
|
141
|
+
Quiz::Worldcup.all.clear
|
142
|
+
Quiz::BALONDOR.all.clear
|
143
|
+
|
140
144
|
end
|
141
145
|
|
142
146
|
|
data/lib/quiz/scraper.rb
CHANGED
@@ -9,17 +9,22 @@ class Quiz::Scraper
|
|
9
9
|
|
10
10
|
def self.balon_d_or_players
|
11
11
|
balon_d_or_url = "https://www.goal.com/es/noticias/todos-los-ganadores-del-balon-de-oro/wn19xivn1eh91t0jrslbzz5kq"
|
12
|
-
balon_de_or_files = "
|
13
|
-
|
14
|
-
|
15
|
-
players[
|
12
|
+
balon_de_or_files = "table"
|
13
|
+
|
14
|
+
players = self.scraper(balon_d_or_url,balon_de_or_files).map{|l|l.text}
|
15
|
+
years = players[1].split(/\D/).reject{|e|e.empty?}
|
16
|
+
years[1] = "2020"
|
17
|
+
players = players[1].split(/\d/).reject{|e|e.empty?}
|
18
|
+
players[0] = "Lionel Messi"
|
19
|
+
players[1] = "Event was Cancel because Covi-19"
|
16
20
|
counter = 0
|
17
21
|
all_players = []
|
18
|
-
while counter < players
|
19
|
-
all_players << {:winner => players[
|
20
|
-
counter +=
|
22
|
+
while counter < players.size
|
23
|
+
all_players << {:winner => players[counter],:year => years[counter]}
|
24
|
+
counter += 1
|
21
25
|
end
|
22
|
-
|
26
|
+
|
27
|
+
p all_players
|
23
28
|
end
|
24
29
|
|
25
30
|
|
@@ -46,14 +51,14 @@ class Quiz::Scraper
|
|
46
51
|
champions.shift
|
47
52
|
10.times{champions[0].shift}
|
48
53
|
23.times{champions[0].pop}
|
49
|
-
|
54
|
+
2.times{champions[0].delete_at(152)}
|
50
55
|
counter = 0
|
51
56
|
all_teams = []
|
52
57
|
while counter < champions[0].size
|
53
58
|
all_teams << {:year => champions[0][counter], :winner => champions[0][counter + 2], :score => champions[0][counter + 3], :runner_up => champions[0][counter + 5], :host => champions[0][counter + 6]}
|
54
59
|
counter += 8
|
55
60
|
end
|
56
|
-
|
61
|
+
all_teams
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
data/lib/quiz/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soccer-quiz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yarvin Hernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/quiz/version.rb
|
100
100
|
- lib/quiz/world_cup.rb
|
101
101
|
- quiz.gemspec
|
102
|
+
- soccer-quiz-0.2.1.gem
|
102
103
|
homepage: https://rubygems.org/gems/soccer_quiz
|
103
104
|
licenses:
|
104
105
|
- MIT
|