Sha256: e90226679ad362f45bc6219c2ac8ab67b19b039cf124b0d094d92ba1648d5193

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 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 to_row
    "#{emoji}#{name}"
  end

  def team
    @team ||= Team.new(@data['team'].to_sym)
  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

1 entries across 1 versions & 1 rubygems

Version Path
qwtf_discord_bot-0.4.1 lib/player.rb