csstats 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/README.md +6 -6
- data/csstats.gemspec +2 -2
- data/lib/csstats/handler.rb +10 -15
- data/lib/csstats/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7af1111cba3fbcebf12a2a0578fb3985b96c498
|
4
|
+
data.tar.gz: ed56d30db6ae2f8fa927ffc9ab73fd174e61f004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d1cc0ad34d13a77635636e1b2f42696a309db66d91e239020fcd9833a2f811010b8a25561db404a3f34322b98e13c3243d7f20ecb7d06cddc5f4a42c08124ce
|
7
|
+
data.tar.gz: 058600f16b155ddfc7d9b91dce6d7fefd46dd5697e852186cc5fd798854c78c66d57476132b00ea9bb88f6088f7caaefda7e6c40a347c1ddbed6c369e1af9d0f
|
data/Gemfile
CHANGED
@@ -3,9 +3,9 @@ source 'https://rubygems.org'
|
|
3
3
|
gem 'rake'
|
4
4
|
|
5
5
|
group :test do
|
6
|
-
gem 'coveralls', '~> 0.7.
|
7
|
-
gem 'rspec', '~> 3.
|
8
|
-
gem 'simplecov', '~> 0.
|
6
|
+
gem 'coveralls', '~> 0.7.1', require: false
|
7
|
+
gem 'rspec', '~> 3.1.0'
|
8
|
+
gem 'simplecov', '~> 0.9.0', require: false
|
9
9
|
end
|
10
10
|
|
11
11
|
gemspec
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# CSstats
|
2
2
|
|
3
|
+
[![Gem Version](http://img.shields.io/gem/v/csstats.svg?style=flat)][rubygems]
|
4
|
+
[![Build Status](http://img.shields.io/travis/jpalumickas/csstats/master.svg?style=flat)][travis]
|
5
|
+
[![Dependency Status](http://img.shields.io/gemnasium/jpalumickas/csstats.svg?style=flat)][gemnasium]
|
6
|
+
[![Coverage Status](https://img.shields.io/coveralls/jpalumickas/csstats.svg?branch=master&style=flat)][coveralls]
|
7
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/jpalumickas/csstats.svg?style=flat)][codeclimate]
|
8
|
+
|
3
9
|
Gem which handle `csstats.dat` file generated by CSX module
|
4
10
|
in AMX Mod X ([http://www.amxmodx.org/][amxx])
|
5
11
|
|
6
|
-
[![Gem Version](https://badge.fury.io/rb/csstats.png)][rubygems]
|
7
|
-
[![Build Status](https://secure.travis-ci.org/jpalumickas/csstats.png?branch=master)][travis]
|
8
|
-
[![Dependency Status](https://gemnasium.com/jpalumickas/csstats.png?travis)][gemnasium]
|
9
|
-
[![Coverage Status](https://coveralls.io/repos/jpalumickas/csstats/badge.png?branch=master)][coveralls]
|
10
|
-
[![Code Climate](https://codeclimate.com/github/jpalumickas/csstats.png)][codeclimate]
|
11
|
-
|
12
12
|
## Installation
|
13
13
|
|
14
14
|
Add this line to your application's Gemfile:
|
data/csstats.gemspec
CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
21
|
gem.require_paths = ['lib']
|
22
22
|
|
23
|
-
gem.add_dependency 'hashie', '~> 3.
|
24
|
-
gem.add_development_dependency 'bundler', '~> 1.
|
23
|
+
gem.add_dependency 'hashie', '~> 3.3'
|
24
|
+
gem.add_development_dependency 'bundler', '~> 1.5'
|
25
25
|
end
|
data/lib/csstats/handler.rb
CHANGED
@@ -14,23 +14,23 @@ module CSstats
|
|
14
14
|
def initialize(options = {})
|
15
15
|
@path = options[:path]
|
16
16
|
@players = []
|
17
|
-
|
18
|
-
maxplayers = options[:maxplayers] || 0
|
19
|
-
|
20
17
|
return if path.nil?
|
21
18
|
|
22
|
-
|
19
|
+
maxplayers = options[:maxplayers] || 0
|
23
20
|
|
24
|
-
|
21
|
+
file = File.new(path, 'r')
|
22
|
+
file_version = read_short_data(file)
|
25
23
|
|
26
24
|
i = 0
|
27
|
-
while !
|
28
|
-
player = read_player(
|
25
|
+
while !file.eof? && (maxplayers == 0 || i < maxplayers)
|
26
|
+
player = read_player(file)
|
27
|
+
|
29
28
|
if player
|
30
29
|
player['rank'] = i + 1
|
31
30
|
players[i] = player
|
32
31
|
end
|
33
|
-
|
32
|
+
|
33
|
+
i += 1
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -40,9 +40,7 @@ module CSstats
|
|
40
40
|
#
|
41
41
|
# Returns the Mash of player information.
|
42
42
|
def player(id)
|
43
|
-
|
44
|
-
players[id - 1]
|
45
|
-
end
|
43
|
+
players[id - 1]
|
46
44
|
end
|
47
45
|
|
48
46
|
# Public: Get total players count.
|
@@ -58,9 +56,7 @@ module CSstats
|
|
58
56
|
#
|
59
57
|
# Returns the Mash of player information.
|
60
58
|
def search_by_name(name)
|
61
|
-
players.
|
62
|
-
return player if name == player.nick
|
63
|
-
end
|
59
|
+
players.find { |player| player.nick == name }
|
64
60
|
end
|
65
61
|
|
66
62
|
private
|
@@ -92,7 +88,6 @@ module CSstats
|
|
92
88
|
# Returns The Mash of player information.
|
93
89
|
def read_player(handle)
|
94
90
|
length = read_short_data(handle)
|
95
|
-
|
96
91
|
return nil if length == 0
|
97
92
|
|
98
93
|
mash = Hashie::Mash.new
|
data/lib/csstats/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '3.
|
26
|
+
version: '3.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.5'
|
41
41
|
description: " Gem which handle csstats.dat file generated by CSX module in AMX Mod
|
42
42
|
X (http://www.amxmodx.org/) "
|
43
43
|
email: jpalumickas@gmail.com
|