Class: CSstats::Writer::Players

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(players) ⇒ Players



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

def initialize(players)
  @players = players
end

Instance Attribute Details

#playersObject (readonly)

Returns the value of attribute players.



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

def players
  @players
end

Instance Method Details

#write(file_path) ⇒ Object



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

def write(file_path)
  file = File.new(file_path, 'w')
  handler = CSstats::Writer::FileWriter::Handler.new(file)

  handler.write_short_data(11) # File version

  players.each do |player|
    CSstats::Writer::Player.new(player).write(handler)
  end

  file.close
end