Class: Termit::TextTranslator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ TextTranslator

Returns a new instance of TextTranslator.



6
7
8
9
# File 'lib/termit/text_translator.rb', line 6

def initialize options
  @options = options.merge(talk: false)
  @url = Termit::UrlConstructor.new(@options).url
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#callObject



11
12
13
14
# File 'lib/termit/text_translator.rb', line 11

def call
  response = Termit::TextFetcher.new(@url, @options[:text]).data
  @text = Termit::TextResponseHandler.new(response.body).call
end