Class: CSstats::Parser::Writer::Player

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(streamer, player) ⇒ Player

Returns a new instance of Player.



9
10
11
12
# File 'lib/csstats/parser/writer/player.rb', line 9

def initialize(streamer, player)
  @streamer = streamer
  @player = player
end

Instance Attribute Details

#playerObject (readonly)

Returns the value of attribute player.



7
8
9
# File 'lib/csstats/parser/writer/player.rb', line 7

def player
  @player
end

#streamerObject (readonly)

Returns the value of attribute streamer.



7
8
9
# File 'lib/csstats/parser/writer/player.rb', line 7

def streamer
  @streamer
end

Instance Method Details

#writeObject



14
15
16
17
18
19
20
21
# File 'lib/csstats/parser/writer/player.rb', line 14

def write
  CSstats::COLUMNS.each do |column|
    next streamer.write_int_data(0) if column.empty?

    value = player.send(column[:name])
    send("write_#{column[:type]}", value)
  end
end