Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Zoo
- class InvalidEndDate < Exception; end
- attr_reader :name, :season_opening_date, :season_closing_date, :cages, :employees
- def initialize(name, season_opening_date, season_closing_date )
- # require 'pry'
- @name = name
- if (season_closing_date < season_opening_date)
- raise InvalidEndDate
- else
- @season_opening_date = season_opening_date
- @season_closing_date = season_closing_date
- end
- @cages = []
- 10.times do
- @cages << Cage.new
- end
- @employees = []
- end
- def add_employee(employee)
- @employees << employee
- end
- def open?(date)
- # puts "Date: #{date}"
- # puts "Opening date #{@season_opening_date}"
- # puts "Closing date #{@season_closing_date}"
- if date > @season_opening_date && date < @season_closing_date
- return true
- else
- return false
- puts "Wth?"
- raise InvalidEndDate
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement