Class: HappyHour::CLI

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

Instance Method Summary collapse

Instance Method Details

#bar_listObject



16
17
18
19
20
21
# File 'lib/happy_hour/cli.rb', line 16

def bar_list
  HappyHour::Bar.all.each.with_index(1) do |bar, i|
  puts "#{i}. #{bar.name}"
     #binding.pry
  end
end

#callObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/happy_hour/cli.rb', line 3

def call
  puts "*************************************"
  puts ""
  puts "Welcome! Let's get your Happy on!!!"
  puts "-------------------------------------"
  puts "-------------------------------------"
  HappyHour::Bar.scrape_bars
  bar_list
  more_info
  goodbye
end

#goodbyeObject



51
52
53
54
55
# File 'lib/happy_hour/cli.rb', line 51

def goodbye
  puts ""
  puts "Thanks for visiting! Come back soon!!!"
  puts ""
end

#more_infoObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/happy_hour/cli.rb', line 23

def more_info
 input = nil
  while input != 'exit'
    puts ""
    puts "Enter number for details for bar of choice:"
    puts ""
    input = gets.strip.downcase
   if input.to_i > 0 && input.to_i <= HappyHour::Bar.all.length
      bar = HappyHour::Bar.all[input.to_i]
    puts ""
    puts "#{bar.name}"
    puts "************************"
    puts "#{bar.description}"
    puts "************************"
    puts ""
    puts "For main list of bars, type 'list', to leave, type 'exit'."
    elsif input == 'list'
      bar_list
    elsif input == 'exit'

    else
      puts ""
      puts "Oops! Think you pressed the wrong number."
    #binding.pry
   end
 end
end