Class: CLI

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

Class Method Summary collapse

Class Method Details

.callObject



3
4
5
6
7
# File 'lib/xkcd_calendar_facts/CLI.rb', line 3

def self.call
  puts ""
  puts "------------------XKCD CALENDAR FACTS-------------------"
  self.start
end


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/xkcd_calendar_facts/CLI.rb', line 19

def self.menu(input)
  case input
  when "\n"
    FactGenerator.new.print_fact(FACTS)
    puts ""
    puts "--Press <ENTER> to learn another interesting calendar fact!"
    puts "--Enter anything else to exit..."
    puts ""
    input = gets
    self.menu(input)
  else
    puts "--Visit xkcd.com for more!"
    puts "--Goodbye!"
  end
end

.startObject



9
10
11
12
13
14
15
16
17
# File 'lib/xkcd_calendar_facts/CLI.rb', line 9

def self.start
  puts "--------------------------------------------------------"
  puts "--Press <ENTER> to learn an interesting calendar fact!--"
  puts "--Enter anything else to exit..."
  
  input = gets
  
  self.menu(input)
end