Sha256: 525e1558807ac5221ffa49b362acd1bea5abb3ee1d9a9b70efddf82b0afb2421
Contents?: true
Size: 811 Bytes
Versions: 66
Compression:
Stored size: 811 Bytes
Contents
class Team attr_accessor :name, :number, :players TEAMS = { 'blue' => 1, 'red' => 2, 'yell' => 3, 'gren' => 4, 'spec' => 5 }.freeze def initialize(name) @name = build_name(name) @number = TEAMS[name] || 5 @players = [] end def enlist(player) @players << player end def to_embed_field Discordrb::Webhooks::EmbedField.new(inline: true, name: field_name, value: player_list) end private def field_name name = @name.capitalize return name.to_s unless playing? "#{name} | #{score}" end def playing? (1..4).include?(@number) end def player_list players.map(&:to_row).join("\n") end def score return nil if @name == 'spec' @players.first.score end def build_name(name) return name if TEAMS[name] 'spec' end end
Version data entries
66 entries across 66 versions & 1 rubygems