overwatch_stats 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12a23f0a4ce04ba1442e5ac678da448b3720db3e
4
- data.tar.gz: 9b6993fef1fbe4acfc09848319d5f84dc4d0c571
3
+ metadata.gz: 95f520db75d439300c3177eb54c18db4460eeaba
4
+ data.tar.gz: 20cf615d2c2f1a574161a289b5f6d1b157937b9c
5
5
  SHA512:
6
- metadata.gz: 0ddb36b2e89c5f2bbd45951b56e09edbfee2f242f06919bef1b3281a795e41919ee2cd00fdac39df6fe735d7a07514d11512413205aaa88af3663a1d0c1ed3cb
7
- data.tar.gz: 31f23270ba3099f2b5898e45e6f5c8cf9be4adddb3b17fe23a5453b698716f38e239a9b409be8816ecfaa2ef21e0e4d70f9b7039d88f5030d9a2d1d2d6e91230
6
+ metadata.gz: bb27191b14778bf102d2ca5a7932bf65cc32e38e03307244e0c4c6c8e7deedeb1042fa02b4517075deecff968d101bb7885d7872189ba869d8cbe5d8d5f80d28
7
+ data.tar.gz: 78aa37fb2935e66e246c835e414e42c51d2d24fb0d58d4d9ec3af551917256200c3166a1742f712747d231aa022e78b70bc76269d432829cd5af0aa5725b1d31
data/lib/cli.rb CHANGED
@@ -14,7 +14,7 @@ class OverwatchStats::CLI
14
14
  end
15
15
 
16
16
  def menu
17
- puts "Type the following to change sorting rules: '(win)rate' '(pop)ularity' '(score)min' '(kd)ratio' or '(alph)abetically'."
17
+ puts "Type the following to change sorting rules: '(win)rate' '(pop)ularity' '(damage)min' '(kd)ratio' or '(alph)abetically'."
18
18
  puts "Type the name of one of the above heroes to see more about that hero."
19
19
  puts "Type 'exit' to exit."
20
20
 
@@ -25,8 +25,8 @@ class OverwatchStats::CLI
25
25
  elsif input == "popularity" || input == "pop"
26
26
  display_stats_popularity
27
27
  menu
28
- elsif input == "scoremin" || input == "score"
29
- display_stats_scoremin
28
+ elsif input == "damagemin" || input == "damage"
29
+ display_stats_damagemin
30
30
  menu
31
31
  elsif input == "kdratio" || input == "kd"
32
32
  display_stats_herokd
@@ -108,18 +108,19 @@ class OverwatchStats::CLI
108
108
 
109
109
  def display_stats_alphabetically
110
110
  stats = OverwatchStats::StatScraper.current
111
+ byalph = stats.sort_by {|hash| hash[:heroname]}
111
112
  puts ""
112
113
  puts " Stats Sorted Alphabetically"
113
114
  puts "==================================================================================="
114
- puts "|| HERO || TYPE || WINRATE || POPULARITY || SCORE/MIN || K/D Ratio ||"
115
- stats.each.with_index(1) do |herostats, index|
115
+ puts "|| HERO || TYPE || WINRATE || POPULARITY || DAMAGE/MIN || K/D Ratio ||"
116
+ byalph.each.with_index(1) do |herostats, index|
116
117
  show_heroname = check_width(herostats[:heroname], index)
117
118
  show_herotype = check_width(herostats[:herotype], 1 , 8)
118
119
  show_winrate = check_width(herostats[:winrate], 1 , 7)
119
120
  show_popularity = check_width(herostats[:popularity], 1 , 8)
120
- show_scoremin = check_width(herostats[:scoremin], 1 , 8)
121
+ show_damagemin = check_width(herostats[:damagemin], 1 , 8)
121
122
  show_herokd = check_width(herostats[:herokd], 1 , 8)
122
- puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_scoremin} || #{show_herokd} ||"
123
+ puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
123
124
  end
124
125
  puts "==================================================================================="
125
126
  end
@@ -129,15 +130,15 @@ class OverwatchStats::CLI
129
130
  bywinrate = stats.sort_by {|hash| hash[:winrate]}.reverse
130
131
  puts " Stats Sorted by Winrate"
131
132
  puts "==================================================================================="
132
- puts "|| HERO || TYPE || WINRATE || POPULARITY || SCORE/MIN || K/D Ratio ||"
133
+ puts "|| HERO || TYPE || WINRATE || POPULARITY || DAMAGE/MIN || K/D Ratio ||"
133
134
  bywinrate.each.with_index(1) do |herostats, index|
134
135
  show_heroname = check_width(herostats[:heroname], index)
135
136
  show_herotype = check_width(herostats[:herotype], 1 , 8)
136
137
  show_winrate = check_width(herostats[:winrate], 1 , 7)
137
138
  show_popularity = check_width(herostats[:popularity], 1 , 8)
138
- show_scoremin = check_width(herostats[:scoremin], 1 , 8)
139
+ show_damagemin = check_width(herostats[:damagemin], 1 , 8)
139
140
  show_herokd = check_width(herostats[:herokd], 1 , 8)
140
- puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_scoremin} || #{show_herokd} ||"
141
+ puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
141
142
  end
142
143
  puts "==================================================================================="
143
144
  end
@@ -147,33 +148,40 @@ class OverwatchStats::CLI
147
148
  bypopularity = stats.sort_by {|hash| hash[:popularity]}.reverse
148
149
  puts " Stats Sorted by Popularity"
149
150
  puts "==================================================================================="
150
- puts "|| HERO || TYPE || WINRATE || POPULARITY || SCORE/MIN || K/D Ratio ||"
151
+ puts "|| HERO || TYPE || WINRATE || POPULARITY || DAMAGE/MIN || K/D Ratio ||"
151
152
  bypopularity.each.with_index(1) do |herostats, index|
152
153
  show_heroname = check_width(herostats[:heroname], index)
153
154
  show_herotype = check_width(herostats[:herotype], 1 , 8)
154
155
  show_winrate = check_width(herostats[:winrate], 1 , 7)
155
156
  show_popularity = check_width(herostats[:popularity], 1 , 8)
156
- show_scoremin = check_width(herostats[:scoremin], 1 , 8)
157
+ show_damagemin = check_width(herostats[:damagemin], 1 , 8)
157
158
  show_herokd = check_width(herostats[:herokd], 1 , 8)
158
- puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_scoremin} || #{show_herokd} ||"
159
+ puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
159
160
  end
160
161
  puts "==================================================================================="
161
162
  end
162
163
 
163
- def display_stats_scoremin
164
+ def display_stats_damagemin
164
165
  stats = OverwatchStats::StatScraper.current
165
- byscoremin = stats.sort_by {|hash| hash[:scoremin]}.reverse
166
- puts " Stats Sorted by Score/Minute"
166
+ new_array = []
167
+ stats.collect do |x|
168
+ if x[:damagemin].include?(",")
169
+ x[:damagemin].gsub!(",","")
170
+ end
171
+ new_array << x
172
+ end
173
+ bydamagemin = new_array.sort_by {|hash| hash[:damagemin].to_i}.reverse
174
+ puts " Stats Sorted by Damage/Minute"
167
175
  puts "==================================================================================="
168
- puts "|| HERO || TYPE || WINRATE || POPULARITY || SCORE/MIN || K/D Ratio ||"
169
- byscoremin.each.with_index(1) do |herostats, index|
176
+ puts "|| HERO || TYPE || WINRATE || POPULARITY || DAMAGE/MIN || K/D Ratio ||"
177
+ bydamagemin.each.with_index(1) do |herostats, index|
170
178
  show_heroname = check_width(herostats[:heroname], index)
171
179
  show_herotype = check_width(herostats[:herotype], 1 , 8)
172
180
  show_winrate = check_width(herostats[:winrate], 1 , 7)
173
181
  show_popularity = check_width(herostats[:popularity], 1 , 8)
174
- show_scoremin = check_width(herostats[:scoremin], 1 , 8)
182
+ show_damagemin = check_width(herostats[:damagemin], 1 , 8)
175
183
  show_herokd = check_width(herostats[:herokd], 1 , 8)
176
- puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_scoremin} || #{show_herokd} ||"
184
+ puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
177
185
  end
178
186
  puts "==================================================================================="
179
187
  end
@@ -181,17 +189,17 @@ class OverwatchStats::CLI
181
189
  def display_stats_herokd
182
190
  stats = OverwatchStats::StatScraper.current
183
191
  byherokd = stats.sort_by {|hash| hash[:herokd]}.reverse
184
- puts " Stats Sorted by Herokd"
192
+ puts " Stats Sorted by Herokd"
185
193
  puts "==================================================================================="
186
- puts "|| HERO || TYPE || WINRATE || POPULARITY || SCORE/MIN || K/D Ratio ||"
194
+ puts "|| HERO || TYPE || WINRATE || POPULARITY || DAMAGE/MIN || K/D Ratio ||"
187
195
  byherokd.each.with_index(1) do |herostats, index|
188
196
  show_heroname = check_width(herostats[:heroname], index)
189
197
  show_herotype = check_width(herostats[:herotype], 1 , 8)
190
198
  show_winrate = check_width(herostats[:winrate], 1 , 7)
191
199
  show_popularity = check_width(herostats[:popularity], 1 , 8)
192
- show_scoremin = check_width(herostats[:scoremin], 1 , 8)
200
+ show_damagemin = check_width(herostats[:damagemin], 1 , 8)
193
201
  show_herokd = check_width(herostats[:herokd], 1 , 8)
194
- puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_scoremin} || #{show_herokd} ||"
202
+ puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
195
203
  end
196
204
  puts "==================================================================================="
197
205
  end
@@ -1,5 +1,6 @@
1
1
  require 'nokogiri'
2
2
  require 'open-uri'
3
+ require 'pry'
3
4
 
4
5
  require_relative './version'
5
6
  require_relative './cli'
data/lib/statscraper.rb CHANGED
@@ -15,11 +15,12 @@ class OverwatchStats::StatScraper
15
15
  hero_name = x.css("div.row div.table-icon strong span").text
16
16
  hero_type = x.css("div.row div.table-icon strong small").text
17
17
  threenumbers = x.css("span.table-stats-winrate").text
18
- hero_winrate = threenumbers.split("%")[0] + "%"
18
+ hero_winrate = threenumbers.split("%")[0] + "%"
19
19
  hero_popularity = threenumbers.split("%")[1] + "%"
20
- hero_scoremin = threenumbers.split("%")[2]
21
- hero_kd = x.css("div.table-stats-kd span").text + ":1"
22
- stats << {:heroname => hero_name, :herotype => hero_type, :winrate => hero_winrate, :popularity => hero_popularity, :scoremin => hero_scoremin, :herokd => hero_kd}
20
+ kdanddpm = threenumbers.split("%")[2].split(":")
21
+ hero_kd = kdanddpm[0] + ":1"
22
+ hero_damagemin = kdanddpm[1][1..-1]
23
+ stats << {:heroname => hero_name, :herotype => hero_type, :winrate => hero_winrate, :popularity => hero_popularity, :damagemin => hero_damagemin, :herokd => hero_kd}
23
24
  end
24
25
  end
25
26
  stats
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OverwatchStats
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overwatch_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - joelbitar1986
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2016-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,6 +96,7 @@ files:
96
96
  - lib/overwatch_stats.rb
97
97
  - lib/statscraper.rb
98
98
  - lib/version.rb
99
+ - overwatch_stats-0.1.2.gem
99
100
  - overwatch_stats.gemspec
100
101
  homepage: https://github.com/joelbitar1986/OverwatchStats
101
102
  licenses: