Sha256: 926d9f580c505e44591529aba55c94df4b145269095d5640eadd2dd4bd244238
Contents?: true
Size: 846 Bytes
Versions: 38
Compression:
Stored size: 846 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}" 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
38 entries across 38 versions & 1 rubygems