class Competitor

comprises two types: quartet and chorus each has an m-to-m relationship with Contest::Quartet and Contest::Chorus, respectively

Attributes

district[RW]
name[RW]
performances[RW]
type[RW]

Public Class Methods

all() click to toggle source
# File lib/barbershop_contestants/competitor.rb, line 31
def self.all
  @@all
end
create(arg_hash) click to toggle source
# File lib/barbershop_contestants/competitor.rb, line 25
def self.create(arg_hash)
  competitor = self.new(arg_hash)
  competitor.save
  competitor
end
fill_find_or_create(arg_hash) click to toggle source
# File lib/barbershop_contestants/competitor.rb, line 17
def self.fill_find_or_create(arg_hash)
  if self.all.find { |c| c.name == arg_hash[:name] }
    self.fill(arg_hash)
  else
    self.create(arg_hash)
  end
end
find_or_create(arg_hash) click to toggle source
# File lib/barbershop_contestants/competitor.rb, line 13
def self.find_or_create(arg_hash)
  self.all.find { |x| x.name == arg_hash[:name] } || self.create(arg_hash)
end

Public Instance Methods

save() click to toggle source
# File lib/barbershop_contestants/competitor.rb, line 9
def save
  Competitor.all << self
end