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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12b06c1a2f315508f6e2b207eb143068b42a545186a5752b951a56284990c9da
4
- data.tar.gz: e6867326a6edc5597d5bba58ef4eb864a0f427fd523878199e5ef875270c220f
3
+ metadata.gz: 46bb58c54a25f638128a128fa1d029e4d24e77098badc9b00c7fb901734ae1e7
4
+ data.tar.gz: 7e6d63cbf1e1b1168f9a74ae58936c97b37604e1cc9b75a2d70162325cbc7736
5
5
  SHA512:
6
- metadata.gz: 20931e49de05be17d07be0023fc6a32c6ab5067fa47fd662984f9ec44fad3d9ede4e7f2099ebed4602c1798203134021d3183f20496033ecb8899e230012dae1
7
- data.tar.gz: 477acaf1914d82b5a3705b8531774e2fcb78d2b60c5b171e32741293cfe6ba298bd91c7809fb002aa528bb8497246987a808f3a4e85f3d9ccb7df6db65e06d50
6
+ metadata.gz: df295d8ecbaf4507e6a803a2c1b8fa0a5c16b8d2f690381a7768f367c38ce21d558c800ede8c847d0d191fdd01b6d12f71463c946e927564c64ed7ddf0331d01
7
+ data.tar.gz: 735a8f516f488ecd719679ee811d0ffd1d636aee61908d7173383cafca9b88e1d21975008a3f4d11010962eb19a9268833304bb96c19a18d078c16b816f5009b
@@ -102,7 +102,7 @@ class IntermatScrape::Cli
102
102
 
103
103
  def restart?
104
104
  puts ''
105
- puts 'Would you like to do now?'
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
- IntermatScrape::Wrestler.new_by_row(row).tap do |w|
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,3 +1,3 @@
1
1
  module IntermatScrape
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  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(rank, name, school, class_standing, conference)
6
- @rank = rank
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intermat-scrape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Dawson