Sha256: 1635609403340e009079aba7b51015381f4a94795b78cb8956cb6ea5d8f26c00

Contents?: true

Size: 683 Bytes

Versions: 9

Compression:

Stored size: 683 Bytes

Contents

class Player
  PLAYER_CLASSES = {
    'sco' => 'scout',
    'sni' => 'sniper',
    'sol' => 'soldier',
    'dem' => 'demoman',
    'med' => 'medic',
    'pyr' => 'pyro',
    'hwg' => 'hwguy',
    'spy' => 'spy',
    'eng' => 'engineer'
  }.freeze

  def initialize(data)
    @data = data
  end

  def name
    @data['name']
  end

  def score
    @data['score']
  end

  def to_row
    "#{emoji}#{name}"
  end

  def team
    @data['team']
  end

  def player_class
    PLAYER_CLASSES[short_class]
  end

  private

  def emoji
    Emoji.for(team: team.to_s, player_class: player_class)
  end

  def short_class
    skin.split('_').last
  end

  def skin
    @data['skin']
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
qwtf_discord_bot-0.5.8 lib/player.rb
qwtf_discord_bot-0.5.7 lib/player.rb
qwtf_discord_bot-0.5.6 lib/player.rb
qwtf_discord_bot-0.5.5 lib/player.rb
qwtf_discord_bot-0.5.4 lib/player.rb
qwtf_discord_bot-0.5.3 lib/player.rb
qwtf_discord_bot-0.5.2 lib/player.rb
qwtf_discord_bot-0.5.1 lib/player.rb
qwtf_discord_bot-0.5.0 lib/player.rb