class NationalParks::CLI
Constants
- BASE_PATH
Public Instance Methods
call()
click to toggle source
Basic Run #
# File lib/national_parks/CLI.rb, line 8 def call welcome NationalParks::State.scrape_states list_states end
display_parks()
click to toggle source
# File lib/national_parks/CLI.rb, line 95 def display_parks puts "" puts "==================================================".colorize(:yellow) puts "" puts "#{@parks[@i].name.upcase} #{@parks[@i].type.upcase}" puts "-#{@parks[@i].location}-" puts "#{@parks[@i].description}" puts "" puts " - Type 'parks' to return to the parks list." puts " - Type 'states' to return to the states list." puts " - Type 'exit' to leave" end
goodbye()
click to toggle source
# File lib/national_parks/CLI.rb, line 24 def goodbye puts "" puts " Hope to see you again soon!" puts "" exit end
list_parks(choice)
click to toggle source
Park Methods #
# File lib/national_parks/CLI.rb, line 61 def list_parks(choice) @chosen_state = BASE_PATH + @states[choice].url puts "" puts "==".colorize(:green) + "#{NationalParks::Park.state_name(@chosen_state)}" + "==".colorize(:green) @parks = NationalParks::Park.all(@chosen_state) @parks.each.with_index(1) {|park, i| puts " #{i}. #{park.name}"} park_menu end
list_states()
click to toggle source
State Methods #
# File lib/national_parks/CLI.rb, line 33 def list_states @states = NationalParks::State.all puts "" @states.each.with_index(1) {|state, i| puts " #{i}. #{state.name}"} state_menu end
welcome()
click to toggle source
Greetings #
# File lib/national_parks/CLI.rb, line 16 def welcome puts "" puts " /\\ ".colorize(:green) puts " //\\\\".colorize(:green) puts "Welcome to the National Park Service!" + " ||".colorize(:black) sleep(1) end