overwatch_stats 0.1.3 → 0.1.4
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 +23 -30
- data/lib/statscraper.rb +12 -14
- data/lib/version.rb +1 -1
- data/overwatch_stats.gemspec +1 -0
- metadata +16 -3
- data/overwatch_stats-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57a64d7d9a9147cc276521579b046220cc206db
|
4
|
+
data.tar.gz: afaaae2e08ea0df92fe25a5b69310b21740ea3ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82daaa9ac816d968c252293d6a64b507b4571d2b991ccfa802beab25c9cc97e36053764281a120c4c7414380984b514319f36643ae1f7616dcd520c01da8ab8f
|
7
|
+
data.tar.gz: c38e19cfe61f80c0a8f89449b1d25315742e1728369a89f64ed8ce86e772ba4c8617dd96b432f5952ca66f0fce5653a5d1c74220eaf93af95d7710bb0cfa514b
|
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' 'medal(game)' '(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 == "medalpergame" || input == "medal"
|
29
|
+
display_stats_medalpergame
|
30
30
|
menu
|
31
31
|
elsif input == "kdratio" || input == "kd"
|
32
32
|
display_stats_herokd
|
@@ -112,15 +112,15 @@ class OverwatchStats::CLI
|
|
112
112
|
puts ""
|
113
113
|
puts " Stats Sorted Alphabetically"
|
114
114
|
puts "==================================================================================="
|
115
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
115
|
+
puts "|| HERO || TYPE || WINRATE || POPULARITY || MEDALS/GM || K/D Ratio ||"
|
116
116
|
byalph.each.with_index(1) do |herostats, index|
|
117
117
|
show_heroname = check_width(herostats[:heroname], index)
|
118
118
|
show_herotype = check_width(herostats[:herotype], 1 , 8)
|
119
119
|
show_winrate = check_width(herostats[:winrate], 1 , 7)
|
120
120
|
show_popularity = check_width(herostats[:popularity], 1 , 8)
|
121
|
-
|
121
|
+
show_medalpergame = check_width(herostats[:medalpergame], 1 , 8)
|
122
122
|
show_herokd = check_width(herostats[:herokd], 1 , 8)
|
123
|
-
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{
|
123
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_medalpergame} || #{show_herokd} ||"
|
124
124
|
end
|
125
125
|
puts "==================================================================================="
|
126
126
|
end
|
@@ -130,15 +130,15 @@ class OverwatchStats::CLI
|
|
130
130
|
bywinrate = stats.sort_by {|hash| hash[:winrate]}.reverse
|
131
131
|
puts " Stats Sorted by Winrate"
|
132
132
|
puts "==================================================================================="
|
133
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
133
|
+
puts "|| HERO || TYPE || WINRATE || POPULARITY || MEDALS/GM || K/D Ratio ||"
|
134
134
|
bywinrate.each.with_index(1) do |herostats, index|
|
135
135
|
show_heroname = check_width(herostats[:heroname], index)
|
136
136
|
show_herotype = check_width(herostats[:herotype], 1 , 8)
|
137
137
|
show_winrate = check_width(herostats[:winrate], 1 , 7)
|
138
138
|
show_popularity = check_width(herostats[:popularity], 1 , 8)
|
139
|
-
|
139
|
+
show_medalpergame = check_width(herostats[:medalpergame], 1 , 8)
|
140
140
|
show_herokd = check_width(herostats[:herokd], 1 , 8)
|
141
|
-
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{
|
141
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_medalpergame} || #{show_herokd} ||"
|
142
142
|
end
|
143
143
|
puts "==================================================================================="
|
144
144
|
end
|
@@ -148,58 +148,51 @@ class OverwatchStats::CLI
|
|
148
148
|
bypopularity = stats.sort_by {|hash| hash[:popularity]}.reverse
|
149
149
|
puts " Stats Sorted by Popularity"
|
150
150
|
puts "==================================================================================="
|
151
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
151
|
+
puts "|| HERO || TYPE || WINRATE || POPULARITY || MEDALS/GM || K/D Ratio ||"
|
152
152
|
bypopularity.each.with_index(1) do |herostats, index|
|
153
153
|
show_heroname = check_width(herostats[:heroname], index)
|
154
154
|
show_herotype = check_width(herostats[:herotype], 1 , 8)
|
155
155
|
show_winrate = check_width(herostats[:winrate], 1 , 7)
|
156
156
|
show_popularity = check_width(herostats[:popularity], 1 , 8)
|
157
|
-
|
157
|
+
show_medalpergame = check_width(herostats[:medalpergame], 1 , 8)
|
158
158
|
show_herokd = check_width(herostats[:herokd], 1 , 8)
|
159
|
-
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{
|
159
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_medalpergame} || #{show_herokd} ||"
|
160
160
|
end
|
161
161
|
puts "==================================================================================="
|
162
162
|
end
|
163
163
|
|
164
|
-
def
|
164
|
+
def display_stats_medalpergame
|
165
165
|
stats = OverwatchStats::StatScraper.current
|
166
|
-
|
167
|
-
|
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"
|
166
|
+
bymedalpergame = stats.sort_by {|hash| hash[:medalpergame].to_f}.reverse
|
167
|
+
puts " Stats Sorted by Medal/Game"
|
175
168
|
puts "==================================================================================="
|
176
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
177
|
-
|
169
|
+
puts "|| HERO || TYPE || WINRATE || POPULARITY || MEDALS/GM || K/D Ratio ||"
|
170
|
+
bymedalpergame.each.with_index(1) do |herostats, index|
|
178
171
|
show_heroname = check_width(herostats[:heroname], index)
|
179
172
|
show_herotype = check_width(herostats[:herotype], 1 , 8)
|
180
173
|
show_winrate = check_width(herostats[:winrate], 1 , 7)
|
181
174
|
show_popularity = check_width(herostats[:popularity], 1 , 8)
|
182
|
-
|
175
|
+
show_medalpergame = check_width(herostats[:medalpergame], 1 , 8)
|
183
176
|
show_herokd = check_width(herostats[:herokd], 1 , 8)
|
184
|
-
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{
|
177
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_medalpergame} || #{show_herokd} ||"
|
185
178
|
end
|
186
179
|
puts "==================================================================================="
|
187
180
|
end
|
188
181
|
|
189
182
|
def display_stats_herokd
|
190
183
|
stats = OverwatchStats::StatScraper.current
|
191
|
-
byherokd = stats.sort_by {|hash| hash[:herokd]}.reverse
|
184
|
+
byherokd = stats.sort_by {|hash| hash[:herokd].to_f}.reverse
|
192
185
|
puts " Stats Sorted by Herokd"
|
193
186
|
puts "==================================================================================="
|
194
|
-
puts "|| HERO || TYPE || WINRATE || POPULARITY ||
|
187
|
+
puts "|| HERO || TYPE || WINRATE || POPULARITY || MEDALS/GM || K/D Ratio ||"
|
195
188
|
byherokd.each.with_index(1) do |herostats, index|
|
196
189
|
show_heroname = check_width(herostats[:heroname], index)
|
197
190
|
show_herotype = check_width(herostats[:herotype], 1 , 8)
|
198
191
|
show_winrate = check_width(herostats[:winrate], 1 , 7)
|
199
192
|
show_popularity = check_width(herostats[:popularity], 1 , 8)
|
200
|
-
|
193
|
+
show_medalpergame = check_width(herostats[:medalpergame], 1 , 8)
|
201
194
|
show_herokd = check_width(herostats[:herokd], 1 , 8)
|
202
|
-
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{
|
195
|
+
puts "|| #{index}. #{show_heroname} || #{show_herotype} || #{show_winrate} || #{show_popularity} || #{show_medalpergame} || #{show_herokd} ||"
|
203
196
|
end
|
204
197
|
puts "==================================================================================="
|
205
198
|
end
|
data/lib/statscraper.rb
CHANGED
@@ -6,21 +6,19 @@ class OverwatchStats::StatScraper
|
|
6
6
|
|
7
7
|
def self.scrape_all_stats
|
8
8
|
doc = Nokogiri::HTML(open("http://masteroverwatch.com/heroes"))
|
9
|
-
container = doc.css("
|
10
|
-
counter = 0
|
9
|
+
container = doc.css("div.table-body")
|
11
10
|
stats = []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
stats << {:heroname => hero_name, :herotype => hero_type, :winrate => hero_winrate, :popularity => hero_popularity, :damagemin => hero_damagemin, :herokd => hero_kd}
|
11
|
+
counter = 0
|
12
|
+
container.css("div.table-row-content").each do |x|
|
13
|
+
counter = counter + 1
|
14
|
+
if counter >= 1 && counter <= 21
|
15
|
+
hero_name = x.css("div.table-name span.table-name-block strong").text
|
16
|
+
hero_type = x.css("div.table-name span.table-name-block small").text
|
17
|
+
hero_winrate = x.css("div.table-winrate div.bar-outer").text
|
18
|
+
hero_popularity = x.css("div.table-popularity div.bar-outer").text
|
19
|
+
hero_kd = x.css("div.table-kd-ratio div.bar-outer").text
|
20
|
+
hero_medalpergame = x.css("div.table-medals-game div.bar-outer").text
|
21
|
+
stats << {:heroname => hero_name, :herotype => hero_type, :winrate => hero_winrate, :popularity => hero_popularity, :medalpergame => hero_medalpergame, :herokd => hero_kd}
|
24
22
|
end
|
25
23
|
end
|
26
24
|
stats
|
data/lib/version.rb
CHANGED
data/overwatch_stats.gemspec
CHANGED
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.4
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.6.8
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: pry
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
89
|
description: This app displays current stats of Overwatch(tm) heroes based on factors
|
76
90
|
like winrate, popularity, K/D ratio and score/minute.
|
77
91
|
email:
|
@@ -96,7 +110,6 @@ files:
|
|
96
110
|
- lib/overwatch_stats.rb
|
97
111
|
- lib/statscraper.rb
|
98
112
|
- lib/version.rb
|
99
|
-
- overwatch_stats-0.1.2.gem
|
100
113
|
- overwatch_stats.gemspec
|
101
114
|
homepage: https://github.com/joelbitar1986/OverwatchStats
|
102
115
|
licenses:
|
data/overwatch_stats-0.1.2.gem
DELETED
Binary file
|