overwatch_stats 0.1.2 → 0.1.3
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/cli.rb +32 -24
- data/lib/overwatch_stats.rb +1 -0
- data/lib/statscraper.rb +5 -4
- data/lib/version.rb +1 -1
- data/overwatch_stats-0.1.2.gem +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95f520db75d439300c3177eb54c18db4460eeaba
|
4
|
+
data.tar.gz: 20cf615d2c2f1a574161a289b5f6d1b157937b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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' '(
|
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 == "
|
29
|
-
|
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 ||
|
115
|
-
|
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
|
-
|
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} || #{
|
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 ||
|
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
|
-
|
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} || #{
|
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 ||
|
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
|
-
|
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} || #{
|
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
|
164
|
+
def display_stats_damagemin
|
164
165
|
stats = OverwatchStats::StatScraper.current
|
165
|
-
|
166
|
-
|
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 ||
|
169
|
-
|
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
|
-
|
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} || #{
|
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 "
|
192
|
+
puts " Stats Sorted by Herokd"
|
185
193
|
puts "==================================================================================="
|
186
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
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
|
-
|
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} || #{
|
202
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_damagemin} || #{show_herokd} ||"
|
195
203
|
end
|
196
204
|
puts "==================================================================================="
|
197
205
|
end
|
data/lib/overwatch_stats.rb
CHANGED
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
|
-
|
21
|
-
|
22
|
-
|
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
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.
|
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-
|
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:
|