Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. class Zoo
  2. class InvalidEndDate < Exception; end
  3.  
  4. attr_reader :name, :season_opening_date, :season_closing_date, :cages, :employees
  5.  
  6. def initialize(name, season_opening_date, season_closing_date )
  7. # require 'pry'
  8. @name = name
  9. if (season_closing_date < season_opening_date)
  10. raise InvalidEndDate
  11. else
  12. @season_opening_date = season_opening_date
  13. @season_closing_date = season_closing_date
  14. end
  15.  
  16. @cages = []
  17. 10.times do
  18. @cages << Cage.new
  19. end
  20.  
  21. @employees = []
  22. end
  23.  
  24. def add_employee(employee)
  25. @employees << employee
  26. end
  27.  
  28. def open?(date)
  29. # puts "Date: #{date}"
  30. # puts "Opening date #{@season_opening_date}"
  31. # puts "Closing date #{@season_closing_date}"
  32.  
  33. if date > @season_opening_date && date < @season_closing_date
  34. return true
  35. else
  36. return false
  37. puts "Wth?"
  38. raise InvalidEndDate
  39. end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement