class Production

Attributes

details[RW]
label[RW]
show[RW]
year[RW]

Public Class Methods

all() click to toggle source
# File lib/Theatre_Explorer/production.rb, line 16
def self.all
    @@all
end
new(attributes) click to toggle source
# File lib/Theatre_Explorer/production.rb, line 6
def initialize(attributes)
    unless Production.find(attributes["label"])
        @label = label
        attributes.each {|k,v| self.send("#{k}=", v)}
        join_year(year) if year
        join_show(show) if show
        @@all << self
    end
end

Public Instance Methods

join_show(show_label) click to toggle source
# File lib/Theatre_Explorer/production.rb, line 27
def join_show(show_label)
    show = Show.find_or_create(show_label)
    show.type = details["Show type"]
    self.show = show
    show.productions << self
end
join_year(year_label) click to toggle source
# File lib/Theatre_Explorer/production.rb, line 20
def join_year(year_label)
    year_label = Time.now.year.to_s if year_label == ""
    year = Year.find_or_create(year_label)
    self.year = year
    year.productions << self
end
print() click to toggle source