csstats 1.0.3 → 1.0.4

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: 2313cf63067bbd162abce2c0a4c5fe00c87a6379
4
- data.tar.gz: 60a0b3c72b821d3c194588282dbbbf256079e59e
3
+ metadata.gz: 2d51fefc1bb5175635411ea675e5a671aa562e64
4
+ data.tar.gz: e9839b430fb119edea4038620cd40a1d8cfca586
5
5
  SHA512:
6
- metadata.gz: 516528ff7124ea2285562e66a627cbd883ba6f83cdc49471ba2193dbd07f8cf3c58315ac81c9c3faecc397c457bfaa08e8a31d1d818e3ddd47c37cefb488d2e9
7
- data.tar.gz: 390927f04cbdcf054e255af541f83010f15b2156998a5be80d203af25778512d6a284915bc16a5ec14b66bdd05d81a0ff4db508a602c4dd78e9ff1d6ca84f145
6
+ metadata.gz: ead5bc0c0816de8489dfe76cc3056214694b914b476084374858273a1f334404beda7ded468dfca38c75140be17a5326876a4800aaa7e93d45829037a852ecf2
7
+ data.tar.gz: 5abc39e06124efe37b54356fc75f38d9797a61b76bebb1de8805fd04fa90e93c7dc6431e320e71ff4d6736e206ee3dfbef686b51bcd4aef2c12cc0374a75ca89
data/Gemfile CHANGED
@@ -4,8 +4,8 @@ gem 'rake'
4
4
 
5
5
  group :test do
6
6
  gem 'coveralls', '~> 0.7.0', require: false
7
- gem 'rspec', '~> 2.14.1'
8
- gem 'simplecov', '~> 0.7.1', require: false
7
+ gem 'rspec', '~> 3.0.0'
8
+ gem 'simplecov', '~> 0.8.2', require: false
9
9
  end
10
10
 
11
11
  gemspec
@@ -4,20 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'csstats/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "csstats"
7
+ gem.name = 'csstats'
8
8
  gem.version = CSstats::VERSION
9
- gem.authors = ["Justas Palumickas"]
10
- gem.email = ["justas@elish.lt"]
11
- gem.homepage = "https://github.com/jpalumickas/csstats/"
9
+ gem.author = 'Justas Palumickas'
10
+ gem.email = 'jpalumickas@gmail.com'
11
+ gem.homepage = 'https://github.com/jpalumickas/csstats/'
12
12
  gem.summary = gem.description
13
13
  gem.description = %q{ Gem which handle csstats.dat file generated by CSX module in AMX Mod X (http://www.amxmodx.org/) }
14
14
  gem.license = 'MIT'
15
15
 
16
+ gem.required_ruby_version = '>= 1.9.2'
17
+
16
18
  gem.files = `git ls-files`.split($/)
17
19
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
21
+ gem.require_paths = ['lib']
20
22
 
21
- gem.add_dependency 'hashie', '~> 2.0'
23
+ gem.add_dependency 'hashie', '~> 3.0'
22
24
  gem.add_development_dependency 'bundler', '~> 1.0'
23
25
  end
@@ -2,14 +2,10 @@ require 'csstats/error'
2
2
  require 'csstats/handler'
3
3
 
4
4
  module CSstats
5
- class << self
6
-
7
- # Alias for CSstats::Handler.new
8
- #
9
- # Returns CSstats::Handler
10
- def new(options = {})
11
- CSstats::Handler.new(options)
12
- end
13
-
5
+ # Alias for CSstats::Handler.new
6
+ #
7
+ # Returns CSstats::Handler
8
+ def self.new(options = {})
9
+ CSstats::Handler.new(options)
14
10
  end
15
11
  end
@@ -17,11 +17,11 @@ module CSstats
17
17
 
18
18
  maxplayers = options[:maxplayers] || 0
19
19
 
20
- return if @path.nil?
20
+ return if path.nil?
21
21
 
22
- handle = File.new(@path, 'r')
22
+ handle = File.new(path, 'r')
23
23
 
24
- @file_version = read_short_data(handle)
24
+ file_version = read_short_data(handle)
25
25
 
26
26
  i = 0
27
27
  while !handle.eof? && (maxplayers == 0 || i < maxplayers)
@@ -40,8 +40,8 @@ module CSstats
40
40
  #
41
41
  # Returns the Mash of player information.
42
42
  def player(id)
43
- unless @players[id - 1].nil?
44
- @players[id - 1]
43
+ unless players[id - 1].nil?
44
+ players[id - 1]
45
45
  end
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ module CSstats
49
49
  #
50
50
  # Returns the Integer of player count.
51
51
  def players_count
52
- @players.count
52
+ players.count
53
53
  end
54
54
 
55
55
  # Public: Get player by specified name.
@@ -58,7 +58,7 @@ module CSstats
58
58
  #
59
59
  # Returns the Mash of player information.
60
60
  def search_by_name(name)
61
- @players.each do |player|
61
+ players.each do |player|
62
62
  return player if name == player.nick
63
63
  end
64
64
  end
@@ -124,6 +124,7 @@ module CSstats
124
124
  def read_int_data(handle)
125
125
  data = handle.read(4)
126
126
  raise CSstats::Error, 'Cannot read int data.' unless data
127
+
127
128
  data.unpack('V').first
128
129
  end
129
130
 
@@ -135,6 +136,7 @@ module CSstats
135
136
  def read_short_data(handle)
136
137
  data = handle.read(2)
137
138
  raise CSstats::Error, 'Cannot read short data.' unless data
139
+
138
140
  data.unpack('v').first
139
141
  end
140
142
 
@@ -147,8 +149,8 @@ module CSstats
147
149
  def read_string_data(handle, length)
148
150
  data = handle.read(length)
149
151
  raise CSstats::Error, 'Cannot read string data.' unless data
150
- data = data.strip
151
- data
152
+
153
+ data.strip
152
154
  end
153
155
  end
154
156
  end
@@ -1,3 +1,3 @@
1
1
  module CSstats
2
- VERSION = '1.0.3' unless defined?(CSstats::VERSION)
2
+ VERSION = '1.0.4' unless defined?(CSstats::VERSION)
3
3
  end
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.3
4
+ version: 1.0.4
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-02-05 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3.0'
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: '2.0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -40,8 +40,7 @@ dependencies:
40
40
  version: '1.0'
41
41
  description: " Gem which handle csstats.dat file generated by CSX module in AMX Mod
42
42
  X (http://www.amxmodx.org/) "
43
- email:
44
- - justas@elish.lt
43
+ email: jpalumickas@gmail.com
45
44
  executables: []
46
45
  extensions: []
47
46
  extra_rdoc_files: []
@@ -75,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
74
  requirements:
76
75
  - - ">="
77
76
  - !ruby/object:Gem::Version
78
- version: '0'
77
+ version: 1.9.2
79
78
  required_rubygems_version: !ruby/object:Gem::Requirement
80
79
  requirements:
81
80
  - - ">="
@@ -83,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
82
  version: '0'
84
83
  requirements: []
85
84
  rubyforge_project:
86
- rubygems_version: 2.2.0
85
+ rubygems_version: 2.2.2
87
86
  signing_key:
88
87
  specification_version: 4
89
88
  summary: ''