quake_parser 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 +4 -4
- data/lib/main.rb +12 -12
- data/lib/quake_parser.rb +2 -1
- 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: b0debba2b9d2fc5393e6c5389be892702f875d4660237b04983b40a094ccb32e
|
4
|
+
data.tar.gz: 35e618de009c2174e7484d23570c12476581b759343c1d5bca8f3beecb477089
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1c97948995afe19fa7c3abbde6c105e3cb04fface10891151081cf636bc09de0245eddb0a8a86129c8d41be15c21ccecda1d8f120d2b100618c2e75c78ce30
|
7
|
+
data.tar.gz: 7468ad3d52329855024f88463aadd6f52852bccb17f64d5d155fd7a0a00702debf81952ce915de92b142b5f056d719b6044ed39d747e2ae26580d97e1499fe54
|
data/lib/main.rb
CHANGED
@@ -8,29 +8,29 @@ module QuakeParser
|
|
8
8
|
@parser = QuakeParser::Parser.new(File.read(file_path))
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def parser_and_print
|
12
12
|
@parser.parse_file
|
13
|
-
print_games
|
14
|
-
print_ranking
|
15
13
|
end
|
16
|
-
|
17
|
-
def
|
18
|
-
|
14
|
+
|
15
|
+
def get_games
|
16
|
+
games_data = []
|
17
|
+
@parser.games.each { |game| games_data << game.convert_data_to_hash if game }
|
18
|
+
games_data
|
19
19
|
end
|
20
|
-
|
21
|
-
def
|
20
|
+
|
21
|
+
def get_ranking
|
22
22
|
scores = Hash.new(0)
|
23
|
-
|
23
|
+
|
24
24
|
@parser.games.each do |game|
|
25
25
|
next unless game
|
26
|
-
|
26
|
+
|
27
27
|
game.kills.each do |key, value|
|
28
28
|
scores[key] += value
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
ranking = scores.sort_by { |_key, value| -value }.to_h
|
33
|
-
|
33
|
+
ranking
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/quake_parser.rb
CHANGED