Class: CSstats::Parser::Reader::Players

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Players.



9
10
11
12
# File 'lib/csstats/parser/reader/players.rb', line 9

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.



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

def file_path
  @file_path
end

#max_playersObject (readonly)

Returns the value of attribute max_players.



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

def max_players
  @max_players
end

Instance Method Details

#parseObject



14
15
16
17
18
19
20
21
22
# File 'lib/csstats/parser/reader/players.rb', line 14

def parse
  players = []

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

  players
end