Sha256: f9d98e0fe02e90bb938010a15cf6002b674adc6914c67b3adbd8fb982705cb9a

Contents?: true

Size: 696 Bytes

Versions: 4

Compression:

Stored size: 696 Bytes

Contents

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

  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.new(self).to_s
    end

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

    def skin
      @data["skin"]
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qwtf_discord_bot-0.3.3 lib/player.rb
qwtf_discord_bot-0.3.2 lib/player.rb
qwtf_discord_bot-0.3.1 lib/player.rb
qwtf_discord_bot-0.3.0 lib/player.rb