Class: LightTr::Translator
- Inherits:
-
Object
- Object
- LightTr::Translator
- Defined in:
- lib/light_tr/translator.rb
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Translator
constructor
A new instance of Translator.
- #translate(query, target = 'en') ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Translator
Returns a new instance of Translator.
9 10 11 |
# File 'lib/light_tr/translator.rb', line 9 def initialize(api_key) @api_key = api_key end |
Instance Method Details
#translate(query, target = 'en') ⇒ Object
13 14 15 |
# File 'lib/light_tr/translator.rb', line 13 def translate(query, target = 'en') extract_translation(request(query, target)) end |