Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.select_by(sport)
- all.select do |object|
- ATTRIBUTES.any? { |attr| object.public_send(attr).include?(sport) }
- end
- end
- def self.football
- select_by("Football")
- end
- def self.baseball
- select_by("Baseball")
- end
- def self.college_basketball
- select_by("College Basketball")
- end
- def self.nba_basketball
- select_by("NBA")
- end
- def user_input
- input = nil
- input = gets.strip.downcase
- case input
- when "football"
- info = SportsToday::Schedule.football
- show_info(info)
- when "baseball"
- info = SportsToday::Schedule.baseball
- show_info(info)
- post_search_options
- when "college basketball"
- info = SportsToday::Schedule.college_basketball
- show_info(info)
- post_search_options
- when "nba basketball"
- info = SportsToday::Schedule.nba_basketball
- show_info(info)
- post_search_options
- def show_info(info)
- info.collect {|info|
- puts""
- puts""
- puts "nEvent: #{info.sport}"
- puts "nTime: #{info.time}"
- puts "nDescription: #{info.description}"
- puts "nMatchup: #{info.matchup}"
- puts ""
- puts ""
- }
- end
Add Comment
Please, Sign In to add comment