Class: CSstats::Parser::Players

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, options = {}) ⇒ Players

Returns a new instance of Players.



6
7
8
9
# File 'lib/csstats/parser/players.rb', line 6

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

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



4
5
6
# File 'lib/csstats/parser/players.rb', line 4

def file_path
  @file_path
end

#max_playersObject (readonly)

Returns the value of attribute max_players.



4
5
6
# File 'lib/csstats/parser/players.rb', line 4

def max_players
  @max_players
end

Instance Method Details

#parseObject



11
12
13
14
15
16
17
18
19
# File 'lib/csstats/parser/players.rb', line 11

def parse
  players = []

  file_reader.read do |handler, index|
    parse_player(handler, index, players)
  end

  players
end