class CdcNotices::CLI
Public Class Methods
new()
click to toggle source
# File lib/cdc_notices/cli.rb, line 8 def initialize puts "Welcome to the CDC Notice Library." site = Scraper.new("https://wwwnc.cdc.gov/travel/notices") @notice = site.set_attributes end
Public Instance Methods
alert_notices()
click to toggle source
# File lib/cdc_notices/cli.rb, line 64 def alert_notices @notice.display_alerts end
all_notices()
click to toggle source
# File lib/cdc_notices/cli.rb, line 60 def all_notices @notice.display_notices end
call()
click to toggle source
# File lib/cdc_notices/cli.rb, line 15 def call input = "" while input != "exit" puts "What would you like to do?" puts "Press help for a list of commands" input = gets.strip case input when "help" puts "*****************************" puts "all: Display all notices" puts "alerts: Display alerts only." puts "warnings: Display warnings only." puts "watches: Display watches only." puts "readmore: open readmore in browser. 'readmore' press enter then enter the number corresponding to the notice you want" puts "exit: exit the application" puts "******************************" when "all" all_notices when "alerts" alert_notices when "warnings" warning_notices when "watches" watch_notices when "readmore" readmore when "exit" puts "Goodbye" break else end end end
readmore()
click to toggle source
# File lib/cdc_notices/cli.rb, line 51 def readmore puts "Which notice would you like to read?" input = gets.strip input = input.to_i - 1 Launchy.open("#{@notice.notices[input].readmore}") end
warning_notices()
click to toggle source
# File lib/cdc_notices/cli.rb, line 68 def warning_notices @notice.display_warnings end
watch_notices()
click to toggle source
# File lib/cdc_notices/cli.rb, line 72 def watch_notices @notice.display_watches end