<file_sep>######### Band should initialize with a name and hometown

######### Band should have a Band#name and Band#hometown and a band should be able to change it's name

##### Band should have a method Band.all that returns all the instances of Band


##### Band should have a method Band#play_in_venue that takes a venue and date as a string as arguments and associates the band to that venue


##### Band should have a method Band#concerts should return an array of all that band's concerts

##### Band should have a method Band#venues that returns an array of all the venues the band has concerts in

# Band should have a method Band.all_introductions that puts out a message of "Hello, we are {insert band name here} and we're from {insert hometown here}" for each band


class Band

  attr_accessor :name
  attr_reader :hometown

  @@all = []

  def initialize(name, hometown)
    @name = name
    @hometown = hometown
    @@all << self
  end

  def self.all
    @@all
  end

  def play_in_venue(venue, date)
    # takes a venue and date as a string as arguments and associates the band to that venue

    if Concert.all.any? {|concert|  concert.venue == venue && concert.date == date}
      puts "ya booked!"
    else
      Concert.new(date, self, venue)
    end
  end


  def concerts
    # return an array of all that band's concerts
    Concert.all.select do |concert|
      concert.band == self
    end

  end

  def venues
    # returns an array of all the venues the band has concerts in
    self.concerts.map do |concert|
      concert.venue
    end
  end

  # Band should have a method Band.all_introductions that puts out a message of "Hello, we are {insert band name here} and we're from {insert hometown here}" for each band

  def self.all_introductions
    all.each do |band|
      puts "Hello, we are #{band.name} and we're from #{band.hometown}"
    end
  end

  




end
<file_sep>### Concert should have a Concert.all method which returns all the instances of Concert
#### Concert should initialize with a date, band, and venue
#### Concert should have methods Concert#band and Concert#venue that return the band and venue associated to the Concert
#### Concert should have a method Concert#hometown_show? that returns true if the concert is in the band's hometown


class Concert

  attr_accessor :date, :band, :venue

  @@all = []

  def initialize(date, band, venue)
    @date = date
    @band = band
    @venue = venue
    @@all << self
  end

  def self.all
    @@all
  end

  def hometown_show?
    # returns true if the concert is in the band's hometown
    self.venue.city == self.band.hometown
  end

  def introduction
    if self.hometown_show?
      puts "Hello, we are #{band.name} and we're happy to be home in #{venue.city}!"
    else
      puts "Hello, we are #{band.name} and we're happy to be in #{venue.city}."
    end
  end


end
<file_sep>require 'pry'
require_relative './band.rb'
require_relative './concert.rb'
require_relative './venue.rb'

green_day = Band.new("Green Day", "Sanduski, OH")
paramore = Band.new("Paramore", "Shrug... Canada?")
band = Band.new("the band", "prolly like georgia")

aboot_playhouse = Venue.new("Aboot Playhouse", "Shrug... Canada?")
msg = Venue.new("Madison Square Garden", "NYC")

paramore_show_ca = Concert.new("03/24/18", paramore, aboot_playhouse)
green_day_msg = Concert.new("02/24/18", green_day, msg)
band_msg = Concert.new("03/24/76", band, msg)


binding.pry

hi = 'hello'
<file_sep>##### Venue should initialize with a title and city
##### Venue should have a method Venue.all method which returns all the instances of Venue


##### Venue should have a method Venue#concerts that lists all the concerts that have ever been performed in that venue

##### Venue should have a method Venue#bands that lists all the bands that have ever played in that venue

class Venue

  attr_reader :title, :city

  @@all = []

  def initialize(title, city)
    @title = title
    @city = city
    @@all << self
  end

  def self.all
    @@all
  end

  def concerts
    # lists all the concerts that have ever been performed in that venue
    concerts = Concert.all.select do |concert|
      concert.venue == self
    end
    concerts
  end

  def bands
    # lists all the bands that have ever played in that venue
    self.concerts.map do |concert|
      concert.band
    end
  end


end
