class Contest
holds the data specific to each contest
Attributes
city[RW]
now there's text again
performances[RW]
now there's text again
type[RW]
now there's text again
year[RW]
now there's text again
Public Class Methods
all()
click to toggle source
# File lib/barbershop_contestants/contest.rb, line 29 def self.all @@all end
create(arg_hash)
click to toggle source
# File lib/barbershop_contestants/contest.rb, line 23 def self.create(arg_hash) contest = self.new(arg_hash) contest.save contest end
find_or_create(arg_hash)
click to toggle source
# File lib/barbershop_contestants/contest.rb, line 19 def self.find_or_create(arg_hash) self.all.find { |x| x.year == arg_hash[:year] && x.type == arg_hash[:type] } || self.create(arg_hash) end
new(arg_hash)
click to toggle source
# File lib/barbershop_contestants/contest.rb, line 8 def initialize(arg_hash) self.performances = (arg_hash[:performances] || []) self.year = arg_hash[:year] self.city = arg_hash[:city] self.type = arg_hash[:type] end
Public Instance Methods
save()
click to toggle source
# File lib/barbershop_contestants/contest.rb, line 15 def save Contest.all << self end