class AirQualityIndex::CLI

Public Instance Methods

call() click to toggle source

instantiates a new CLI instance for the program

# File lib/air_quality_index/cli.rb, line 4
def call

  puts ''
  puts "Welcome to Air Quality Index (AQI) Grabber"
  puts ''

  self.list_options
  self.menu

end
data_unavailable_message() click to toggle source

data unavailability message if hours between midnight and 4am EST

# File lib/air_quality_index/cli.rb, line 82
def data_unavailable_message
  puts ''
  puts 'Updates for current conditions are not available between 12:00 a.m. and 4:00a.m. EST.'
end
list_options() click to toggle source

lists menu options for user to select from

# File lib/air_quality_index/cli.rb, line 16
  def list_options
    puts <<-DOC.gsub /^\s*/, ''

    1. Local AQI Information
    2. Top 5 Nationwide AQI Rankings
    3. General AQI Information

    DOC
  end
menu() click to toggle source

grabs user selection from menu and instantiates appropriate method based on that selection

return_message() click to toggle source

return message displayed after each menu selection call

# File lib/air_quality_index/cli.rb, line 70
def return_message
  puts "Type 'return' to go back to previous menu, or type 'exit'."
  puts ""
end
time_check() click to toggle source

check to see if current time is between midnight and 4am EST (Data Unavailable During This Time)

# File lib/air_quality_index/cli.rb, line 76
def time_check
  time =  Time.now.getlocal('-04:00')
  time.hour.between?(0,4)
end