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.



14
15
16
17
18
19
# File 'lib/csstats/client.rb', line 14

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.



5
6
7
# File 'lib/csstats/client.rb', line 5

def file_path
  @file_path
end

#max_playersObject (readonly)

Returns the value of attribute max_players.



5
6
7
# File 'lib/csstats/client.rb', line 5

def max_players
  @max_players
end

Instance Method Details

#playersObject



21
22
23
# File 'lib/csstats/client.rb', line 21

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