class OwHeroesRoster::CLI
Public Instance Methods
call()
click to toggle source
# File lib/ow_heroes_roster/cli.rb, line 5 def call puts "\nWELCOME TO THE OVERWATCH HEROES ROSTER GEM!".colorize(:green) puts "\n----***------ INSTRUCTIONS ------***----".colorize(:white) puts "\n1. Enter a hero's name to see their details.".colorize(:white) puts "2. To see the roster again, type 'roster'.".colorize(:white) puts "3. To exit the program, type 'exit'.".colorize(:white) puts "\n----------------------------------------".colorize(:white) Roster.scrape_roster_page list_heroes menu end
display_hero(input)
click to toggle source
display the details of the requested hero. do I want this here?
# File lib/ow_heroes_roster/cli.rb, line 42 def display_hero(input) #use a find by name method to get the right hero and then display the information if Hero.find_by_name(input) hero = Hero.find_by_name(input) hero.display_information menu else puts "\nSorry could not find a hero by that name. Please try again.".colorize(:green) menu end end
list_heroes()
click to toggle source
print the list of heroes scraped from the site
# File lib/ow_heroes_roster/cli.rb, line 18 def list_heroes puts "\n---***------ HEROES ------***---".colorize(:yellow) @heroes = Hero.all Hero.all.each do |hero| print " --- ".colorize(:magenta) puts "#{hero.name}".colorize(:white) end menu end