Class: UpcomingMoviesInThePark::CLI
- Inherits:
-
Object
- Object
- UpcomingMoviesInThePark::CLI
- Defined in:
- lib/upcoming_movies_in_the_park/cli.rb
Instance Method Summary collapse
- #by_date_instructions_1 ⇒ Object
- #by_date_instructions_2 ⇒ Object
- #by_date_path ⇒ Object
- #by_date_path_2(date) ⇒ Object
- #by_name_instructions ⇒ Object
- #by_name_path ⇒ Object
- #by_park_instructions_1 ⇒ Object
- #by_park_instructions_2 ⇒ Object
- #by_park_path ⇒ Object
- #by_park_path_2(park) ⇒ Object
- #call ⇒ Object
- #hrm ⇒ Object
- #menu ⇒ Object
- #menu_path ⇒ Object
Instance Method Details
#by_date_instructions_1 ⇒ Object
142 143 144 145 146 147 148 149 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 142 def by_date_instructions_1 print "Enter ".colorize(:green) print "a number " puts "to get a list of movies playing on that date".colorize(:green) print "or enter ".colorize(:green) print "back" puts " to go back to the main menu.".colorize(:green) end |
#by_date_instructions_2 ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 151 def by_date_instructions_2 print "Enter ".colorize(:cyan) print "another number" puts " to get the showing details for that movie".colorize(:cyan) print "or enter ".colorize(:cyan) print "return" puts " to go return to the list of upcoming dates".colorize(:cyan) puts "on which movies are playing in a park.".colorize(:cyan) end |
#by_date_path ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 94 def by_date_path puts "\n" UpcomingMoviesInThePark::Gate.list_by_date puts "\n" by_date_instructions_1 input = nil while input != "back" input = gets.strip if input.to_i > 0 && input.to_i <= UpcomingMoviesInThePark::Gate.all.length date = UpcomingMoviesInThePark::Gate.all[input.to_i - 1] puts "\n" date.list_showings puts "\n" by_date_instructions_2 by_date_path_2(date) elsif input == "back" break else puts hrm.colorize(:green) by_date_instructions_1 end end end |
#by_date_path_2(date) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 119 def by_date_path_2(date) input = nil while input != "return" input = gets.strip if input.to_i > 0 && input.to_i <= date.showings.length showing = date.showings[input.to_i - 1] puts "\n" showing.display_details puts "\n" by_date_instructions_2 elsif input == "return" puts "\n" UpcomingMoviesInThePark::Gate.list_by_date puts "\n" by_date_instructions_1 break else puts hrm.colorize(:cyan) by_date_instructions_2 end end end |
#by_name_instructions ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 85 def by_name_instructions print "Enter ".colorize(:green) print "a number" puts " from the list movie names to get the showing details for that movie".colorize(:green) print "or enter ".colorize(:green) print "back" puts " to go back to the main menu.".colorize(:green) end |
#by_name_path ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 60 def by_name_path puts "\n" UpcomingMoviesInThePark::Showing.list_by_name puts "\n" by_name_instructions input = nil while input != "back" input = gets.strip if input.to_i > 0 && input.to_i <= UpcomingMoviesInThePark::Showing.all.length showing = UpcomingMoviesInThePark::Showing.all[input.to_i - 1] puts "\n" showing.display_details puts "\n" by_name_instructions elsif input == "back" break else puts hrm.colorize(:green) by_name_instructions end end end |
#by_park_instructions_1 ⇒ Object
209 210 211 212 213 214 215 216 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 209 def by_park_instructions_1 print "Enter ".colorize(:green) print "a number" puts " to get a list of movies playing in that park ".colorize(:green) print "or enter ".colorize(:green) print "back" puts " to go back to the main menu.".colorize(:green) end |
#by_park_instructions_2 ⇒ Object
218 219 220 221 222 223 224 225 226 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 218 def by_park_instructions_2 print "Enter ".colorize(:cyan) print "another number" puts " to get the showing details for that movie".colorize(:cyan) print "or enter ".colorize(:cyan) print "return" print " to return to the list of parks ".colorize(:cyan) puts "in which upcoming movies are playing.".colorize(:cyan) end |
#by_park_path ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 161 def by_park_path puts "\n" UpcomingMoviesInThePark::Park.list_by_name puts "\n" by_park_instructions_1 input = nil while input != "back" input = gets.strip if input.to_i > 0 && input.to_i <= UpcomingMoviesInThePark::Park.all.length park = UpcomingMoviesInThePark::Park.all[input.to_i - 1] puts "\n" park.list_showings puts "\n" by_park_instructions_2 by_park_path_2(park) elsif input == "back" break else puts hrm.colorize(:green) by_park_instructions_1 end end end |
#by_park_path_2(park) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 186 def by_park_path_2(park) input = nil while input != "return" input = gets.strip if input.to_i > 0 && input.to_i <= park.showings.length showing = park.showings[input.to_i - 1] puts "\n" showing.display_details puts "\n" by_park_instructions_2 elsif input == "return" puts "\n" UpcomingMoviesInThePark::Park.list_by_name puts "\n" by_park_instructions_1 break else puts hrm.colorize(:cyan) by_park_instructions_2 end end end |
#call ⇒ Object
3 4 5 6 7 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 3 def call UpcomingMoviesInThePark::Scraper.new.make_showings end |
#hrm ⇒ Object
56 57 58 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 56 def hrm "Hrm, I don't understand what you want." end |
#menu ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 9 def puts "\n" puts "Upcoming Movies in Chicago Parks".colorize(:blue) puts "\n" puts "How would you like to explore movies in the park?".colorize(:blue) print "Enter".colorize(:blue) print " by name " puts "to see a list of upcoming movies by their names.".colorize(:blue) print "Enter".colorize(:blue) print " by date " puts "to see a list of upcoming dates on which movies are playing in a park.".colorize(:blue) print "Enter".colorize(:blue) print " by park " puts "to see a list of parks in which upcoming movies are playing.".colorize(:blue) print "Or enter".colorize(:blue) print " exit " puts "to quit.".colorize(:blue) end |
#menu_path ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/upcoming_movies_in_the_park/cli.rb', line 28 def input = nil while input != "exit" input = gets.strip if input == "by name" by_name_path elsif input == "by date" by_date_path elsif input == "by park" by_park_path elsif input === "exit" break else puts "\n" puts hrm.colorize(:blue) print "Please enter".colorize(:blue) print " by name" print ", ".colorize(:blue) print "by date" print ", ".colorize(:blue) print "by park" print ", or ".colorize(:blue) print "exit" puts ".".colorize(:blue) end end end |