Class: CSstats::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/csstats/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Public: Initialize file.

options - The Hash options:

:path        - The String of csstats.dat file path (required).
:max_players - The Integer of how many players to return (optional).

Returns nothing.



12
13
14
15
16
17
# File 'lib/csstats/client.rb', line 12

def initialize(options = {})
  @file_path = options[:path]
  @max_players = options[:max_players] || 0

  raise CSstats::FileNotExist unless File.exist?(file_path.to_s)
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



3
4
5
# File 'lib/csstats/client.rb', line 3

def file_path
  @file_path
end

#max_playersObject (readonly)

Returns the value of attribute max_players.



3
4
5
# File 'lib/csstats/client.rb', line 3

def max_players
  @max_players
end

Instance Method Details

#playersObject



19
20
21
# File 'lib/csstats/client.rb', line 19

def players
  @players ||= CSstats::Players.new(self)
end