Sha256: 660345ece18bfbaf5b9823c9a624de838b8dde527cad947014204875d14bba2b
Contents?: true
Size: 807 Bytes
Versions: 6
Compression:
Stored size: 807 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 return 'spec' unless valid_score? @data['team'] end def player_class short_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 && skin.split('_').last[0, 3] end def skin @data['skin'] end def valid_score? score >= 0 end end
Version data entries
6 entries across 6 versions & 1 rubygems