class CLI
Public Instance Methods
call()
click to toggle source
attr_accessor :char_id, :name, :birthday, :occupation, :img, :status, :appearance, :nickname, :portrayed
# File lib/cli.rb, line 5 def call API.new.call_api puts "Welcome to the Breaking Bad Character Finder!" choose_a_character end
choose_a_character()
click to toggle source
# File lib/cli.rb, line 12 def choose_a_character puts "" puts "Press Enter to view a list of characters." input = gets.strip.to_i list_characters puts "" puts "Type the number of the character for additional information." input = gets.strip.to_i char = Character.find get_character_details(char) end
get_character_details(char)
click to toggle source
# File lib/cli.rb, line 31 def get_character_details(char) Character.name.find do |char, name| puts "" puts "_________#{char.name}____________" puts "#{}" puts "Occupation: #{char.occupation}" puts "img: #{char.img}" puts "Occupation: #{char.occupation}" puts "Nickname: #{char.nickname}" puts "Portrayed: #{char.portrayed}" end end
list_characters()
click to toggle source
# File lib/cli.rb, line 25 def list_characters Character.all.each.with_index(1) do |char, index| puts "#{index}. #{char.name}" end end