Class: WhatToWatch::CLI

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

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/what_to_watch/cli.rb', line 3

def initialize 
 @input = ""
 @streaming_services = {netflix: "n", amazon_prime: "n", hbo_now: "n", hulu: "n", showtime: "n"}
 puts "==========================================" 
 puts %q[
 __        ___           _     _         
 \ \      / / |__   __ _| |_  | |_ ___   
\ \ /\ / /| '_ \ / _` | __| | __/ _ \  
 \ V  V / | | | | (_| | |_  | || (_) | 
 __ \_/\_/ _|_| |_|\__,_|\__|  \__\___/  
 \ \      / /_ _| |_ ___| |__            
\ \ /\ / / _` | __/ __| '_ \           
 \ V  V / (_| | || (__| | | |          
  \_/\_/ \__,_|\__\___|_| |_|          

]
 puts "=========================================="
 puts ""
 puts "Welcome to What To Watch!"
 puts ""
end

Instance Method Details

#startObject



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
50
51
52
53
54
55
56
57
58
# File 'lib/what_to_watch/cli.rb', line 25

def start
  which_streaming_services
  WhatToWatch::Scraper.scrape_vulture
  while !exit?
    catch(:main_menu) do
      main_commands
      case @input
      when "1", "2", "3", "4"
        print_list
        while !exit?
          options
          if valid_number?(WhatToWatch::Show.filtered)
            print_item
            while !exit?
            item_options
              if @input == "y"
                break
              elsif @input == "n"
                throw(:main_menu)
              else 
              invalid_command
              end
            end
          else
            invalid_command
          end
        end
      else
        invalid_command
      end
    end
  end
  exit
end