intermat-scrape 0.1.2 → 0.2.0
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/lib/intermat_scrape/cli.rb +1 -1
- data/lib/intermat_scrape/scraper.rb +12 -1
- data/lib/intermat_scrape/version.rb +1 -1
- data/lib/intermat_scrape/wrestler.rb +3 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bb58c54a25f638128a128fa1d029e4d24e77098badc9b00c7fb901734ae1e7
|
4
|
+
data.tar.gz: 7e6d63cbf1e1b1168f9a74ae58936c97b37604e1cc9b75a2d70162325cbc7736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df295d8ecbaf4507e6a803a2c1b8fa0a5c16b8d2f690381a7768f367c38ce21d558c800ede8c847d0d191fdd01b6d12f71463c946e927564c64ed7ddf0331d01
|
7
|
+
data.tar.gz: 735a8f516f488ecd719679ee811d0ffd1d636aee61908d7173383cafca9b88e1d21975008a3f4d11010962eb19a9268833304bb96c19a18d078c16b816f5009b
|
data/lib/intermat_scrape/cli.rb
CHANGED
@@ -102,7 +102,7 @@ class IntermatScrape::Cli
|
|
102
102
|
|
103
103
|
def restart?
|
104
104
|
puts ''
|
105
|
-
puts '
|
105
|
+
puts 'What would you like to do now?'
|
106
106
|
puts 'view(v):'.colorize(:light_cyan).concat(' view another wrestler from this weight class')
|
107
107
|
puts 'back(b):'.colorize(:light_cyan).concat(' return to weight classes')
|
108
108
|
puts 'exit:'.colorize(:light_cyan).concat(' exit program')
|
@@ -11,9 +11,20 @@ class IntermatScrape::Scraper
|
|
11
11
|
get_doc_by_weight(weight_class).css('table.table tbody tr')
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.create_hash_from_row(row)
|
15
|
+
{
|
16
|
+
rank: row.children[1].text,
|
17
|
+
name: row.css(':nth-child(2) a').text,
|
18
|
+
school: row.css(':nth-child(3)').text,
|
19
|
+
class_standing: row.css(':nth-child(4)').text,
|
20
|
+
conference: row.css(':nth-child(5)').text
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
14
24
|
def self.create_wrestlers(weight_class)
|
15
25
|
get_rows(weight_class).collect do |row|
|
16
|
-
|
26
|
+
wrestler_hash = create_hash_from_row(row)
|
27
|
+
IntermatScrape::Wrestler.new(wrestler_hash).tap do |w|
|
17
28
|
weight_class.add_wrestler(w)
|
18
29
|
end
|
19
30
|
end
|
@@ -1,23 +1,8 @@
|
|
1
1
|
class IntermatScrape::Wrestler
|
2
|
-
attr_accessor :rank, :weight_class, :school, :class_standing, :conference
|
3
|
-
attr_reader :name
|
2
|
+
attr_accessor :rank, :weight_class, :school, :class_standing, :conference, :name
|
4
3
|
|
5
|
-
def initialize(
|
6
|
-
|
7
|
-
@name = name
|
8
|
-
@school = school
|
9
|
-
@class_standing = class_standing
|
10
|
-
@conference = conference
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.new_by_row(row)
|
14
|
-
new(
|
15
|
-
row.children[1].text,
|
16
|
-
row.css(':nth-child(2) a').text,
|
17
|
-
row.css(':nth-child(3)').text,
|
18
|
-
row.css(':nth-child(4)').text,
|
19
|
-
row.css(':nth-child(5)').text
|
20
|
-
)
|
4
|
+
def initialize(wrestler_hash)
|
5
|
+
wrestler_hash.each { |k, v| self.send("#{k}=", v) }
|
21
6
|
end
|
22
7
|
|
23
8
|
def to_s
|