Class: Termit::TextTranslator
- Inherits:
-
Object
- Object
- Termit::TextTranslator
- Defined in:
- lib/termit/text_translator.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ TextTranslator
constructor
A new instance of TextTranslator.
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 = .merge(talk: false) @url = Termit::UrlConstructor.new(@options).url end |
Instance Attribute Details
#text ⇒ Object (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
#call ⇒ Object
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 |