Class: Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/runner.rb

Instance Method Summary collapse

Instance Method Details

#exitObject



32
33
34
# File 'lib/runner.rb', line 32

def exit
  puts "Thank you for using NY Forecast."
end

#interfaceObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/runner.rb', line 5

def interface
  on = true
  puts "======================================="
  puts "Welcome to NY Forecast"
  puts
  puts "You can view the 6-hour, 24-hour, or 5-day forecast. To view the forecasts,"
  puts "enter the specific amount of time in the following format: '6 hours', '24"
  puts "hours', or '5 days'."
  puts "(Type 'exit' to exit)"

  while on do
    @user_command = gets.chomp
    
    if VALID.include?(@user_command)
      FindForecast.new(@user_command)
      puts "Please enter your next request. Valid requests are '6 hours', '24 hours', "
      puts "'5 days', or 'exit'."
    elsif @user_command == "exit"
      exit
      on = false
    else
      puts "Invalid request! Please enter '6 hours', '24 hours', or '5 days' to view"
      puts "the forecasts."
    end
  end
end