Class: Termit::OutputManager

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

Instance Method Summary collapse

Instance Method Details

#display_error_info_and_quitObject



4
5
6
7
# File 'lib/termit/output_manager.rb', line 4

def display_error_info_and_quit
  puts "TERMIT: Wrong data. Example: 'termit en es the cowboy ' => 'el vaquero'"
  exit
end

#display_help_and_quitObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/termit/output_manager.rb', line 20

def display_help_and_quit
  puts    <<-EOS
=========TERMIT=========
Usage:
termit 'source_language' 'target_language' 'text'

Example:
termit en fr 'hey cowboy where is your horse?'
=> 'hey cow-boy ou est votre cheval?'

Options:
-t - speech synthesis
-s - synonyms list

Check docs at: github.com/pawurb/termit
EOS
  exit
end

#display_player_error_and_quitObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/termit/output_manager.rb', line 9

def display_player_error_and_quit
  message = "Termit speech synthesis requires mpg123 installed."
  case Gem::Platform.local.os
  when "darwin"
    message << "\nPlease run 'brew install mpg123'"
  when "linux"
    message << "\nPlease run 'sudo apt-get install mpg123'"
  end
  abort message
end

#display_synonyms(synonyms) ⇒ Object



50
51
52
53
# File 'lib/termit/output_manager.rb', line 50

def display_synonyms synonyms
  print '=> Synonyms: '
  puts synonyms
end

#display_translation(text) ⇒ Object



45
46
47
48
# File 'lib/termit/output_manager.rb', line 45

def display_translation text
  print "=> "
  puts text
end

#display_version_and_quitObject



40
41
42
43
# File 'lib/termit/output_manager.rb', line 40

def display_version_and_quit
  puts "Termit #{Termit::VERSION}"
  exit
end