Class: Viewer

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

Instance Method Summary collapse

Instance Method Details

#choice_screenObject



11
12
13
14
15
16
17
# File 'lib/viewer.rb', line 11

def choice_screen
  puts "What would you like to see?" 
  puts 
  puts "1 for a Joke"
  puts "2 for a Funny Picture" 
  gets.chomp 
end

#display_image(punchline, image) ⇒ Object



26
27
28
29
30
31
# File 'lib/viewer.rb', line 26

def display_image(punchline, image)
  puts 
  puts punchline
  sleep(3)
  Launchy.open(image)
end

#display_joke(joke) ⇒ Object



19
20
21
22
23
24
# File 'lib/viewer.rb', line 19

def display_joke(joke)
  puts 
  puts joke
  puts 
  sleep(3)
end

#display_punch_line(punch_line) ⇒ Object



33
34
35
36
# File 'lib/viewer.rb', line 33

def display_punch_line(punch_line)
  puts punch_line
  return see_another?
end

#good_byeObject



44
45
46
47
# File 'lib/viewer.rb', line 44

def good_bye
  puts "Come back soon !!"
  exit  
end

#see_another?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/viewer.rb', line 38

def see_another?
  puts 
  puts "Would you like to laugh again ?"
  gets.chomp
end

#welcome_screenObject



5
6
7
8
9
# File 'lib/viewer.rb', line 5

def welcome_screen
  puts 
  puts "Welcome to Jokr. Get ready to laugh." 
  puts 
end