Class: Termit::OutputManager
- Inherits:
-
Object
- Object
- Termit::OutputManager
- Defined in:
- lib/termit/output_manager.rb
Instance Method Summary collapse
- #display_error_info_and_quit ⇒ Object
- #display_error_msg ⇒ Object
- #display_help_and_quit ⇒ Object
- #display_invalid_data_msg ⇒ Object
- #display_player_error_and_quit ⇒ Object
- #display_translation(text) ⇒ Object
- #display_version_and_quit ⇒ Object
Instance Method Details
#display_error_info_and_quit ⇒ Object
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_error_msg ⇒ Object
54 55 56 57 |
# File 'lib/termit/output_manager.rb', line 54 def display_error_msg puts "TERMIT: We are sorry but something went wrong." exit end |
#display_help_and_quit ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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 Check docs at: github.com/pawurb/termit EOS exit end |
#display_invalid_data_msg ⇒ Object
49 50 51 52 |
# File 'lib/termit/output_manager.rb', line 49 def display_invalid_data_msg puts "TERMIT: Looks like you provided invalid options, or speech synthesis is not supported for this language." exit end |
#display_player_error_and_quit ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/termit/output_manager.rb', line 9 def display_player_error_and_quit = "TERMIT: speech synthesis requires mpg123 installed." case Gem::Platform.local.os when "darwin" << "\nPlease run 'brew install mpg123'" when "linux" << "\nPlease run 'sudo apt-get install mpg123'" end abort end |
#display_translation(text) ⇒ Object
44 45 46 47 |
# File 'lib/termit/output_manager.rb', line 44 def display_translation text print "=> " puts text end |