Class: FortuneTeller::CLI

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

Instance Method Summary collapse

Instance Method Details

#callObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fortune_teller/cli.rb', line 2

def call
  puts "      *       *       *         "
  puts "   *          **            *   "
  puts "      *       ***    *          "
  puts "   WELCONE     ****            "
  puts "     TO          ****       *    "
  puts "    YOUR            ****        "
  puts "   FORTUNE       *    ****"
  puts "   TELLER                ***     "
  puts "           *                 ***"
  puts "    *                              **"
  puts "Do you want to know what your horoscope tells you today??"
  horoscope_list
  puts "**************************************************"
  menu
  puts "**************************************************"
  see_you
end

#horoscope_listObject



20
21
22
23
24
25
26
27
# File 'lib/fortune_teller/cli.rb', line 20

def horoscope_list
  FortuneTeller::HoroscopeScraping.scrape_nypost_horoscope
  @horoscopes=FortuneTeller::Horoscope.all
  @horoscopes.each.with_index(1) do |hs, i|
   puts "#{i}. #{hs.name}"
   puts "  #{hs.date}"
  end
end


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fortune_teller/cli.rb', line 28

def menu
  input=nil
  while input != "exit"
    puts "selecte your horoscope enter a number or type exit"
    puts "**************************************************"
    input = gets.strip.downcase
    puts " "
    if input=="list"
     horoscope_list
    elsif input.to_i > 0 && input.to_i <= 12
      puts " Your horoscope today:*** #{@horoscopes[input.to_i-1].content}**"
      puts "**************************************************"
    else
     puts "not included select a number or type list or exit."
     puts"***************************************************"
    end
  end
end

#see_youObject



46
47
48
49
50
51
52
53
# File 'lib/fortune_teller/cli.rb', line 46

def see_you
  puts "Thank you for using our application. See you next time!"
  puts "***     *** "
  puts "*    *    *"
  puts " * BYE!! *"
  puts "  *    *"
  puts "     *"
end