Skip to content

Instantly share code, notes, and snippets.

@MostlyFocusedMike
Last active May 5, 2018 21:33
Show Gist options
  • Save MostlyFocusedMike/b886d54eeb49318f0896ecb3aab5d2c6 to your computer and use it in GitHub Desktop.
Save MostlyFocusedMike/b886d54eeb49318f0896ecb3aab5d2c6 to your computer and use it in GitHub Desktop.
class StandUp |class Club
|
attr_accessor :name | attr_accessor :club_name
|
@@all = [] | @@all = []
|
def initialize(name) | def initialize(club_name)
@name = name | @club_name = club_name
@@all << self | @@all << self
end | end
|
def self.all | def self.all
@@all | @@all
end | end
|
def all_shows_performed | def all_shows_at_club
Show.all.select do |show| | Show.all.select do |show|
show.stand_up == self | show.club == self
end | end
end | end
|
def all_clubs | def all_stand_ups
self.all_shows_performed.map do |show| | self.all_shows_at_club.map do |show|
show.club | show.stand_up
end.uniq | end
end | end
end |end
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment