Class: Translatomatic::Translator::Yandex
- Defined in:
- lib/translatomatic/translator/yandex.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Yandex
constructor
Create a new Yandex translator instance.
-
#languages ⇒ Array<String>
A list of languages supported by this translator.
Methods inherited from Base
Methods included from Util
Constructor Details
#initialize(options = {}) ⇒ Yandex
Create a new Yandex translator instance
13 14 15 16 17 18 |
# File 'lib/translatomatic/translator/yandex.rb', line 13 def initialize( = {}) super() key = [:yandex_api_key] || ENV["YANDEX_API_KEY"] raise "yandex api key required" if key.nil? @impl = ::Yandex::Translator.new(key) end |
Instance Method Details
#languages ⇒ Array<String>
Returns A list of languages supported by this translator.
21 22 23 |
# File 'lib/translatomatic/translator/yandex.rb', line 21 def languages @languages ||= @impl.langs.collect { |i| i[0, 2] }.uniq end |