Class: Termit::TextResponseHandler

Inherits:
Object
  • Object
show all
Includes:
CanOutput
Defined in:
lib/termit/text_response_handler.rb

Instance Method Summary collapse

Methods included from CanOutput

included, #output_manager

Constructor Details

#initialize(text, synonyms_wanted) ⇒ TextResponseHandler

Returns a new instance of TextResponseHandler.



7
8
9
10
# File 'lib/termit/text_response_handler.rb', line 7

def initialize text, synonyms_wanted
  @text = decode text
  @synonyms_wanted = synonyms_wanted
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/termit/text_response_handler.rb', line 12

def call
  translation = extract_translation
  display_translation translation
  display_synonyms extract_synonyms if @synonyms_wanted
  translation
end