Class: CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject

attr_accessor :char_id, :name, :birthday, :occupation, :img, :status, :appearance, :nickname, :portrayed



5
6
7
8
9
10
# 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_characterObject



12
13
14
15
16
17
18
19
20
21
22
23
# 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) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# 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_charactersObject



25
26
27
28
29
# File 'lib/cli.rb', line 25

def list_characters
  Character.all.each.with_index(1) do |char, index|
    puts  "#{index}. #{char.name}"
  end
end