Class: Translatomatic::Translator::Google
- Defined in:
- lib/translatomatic/translator/google.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Google
constructor
Create a new Google 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 = {}) ⇒ Google
Create a new Google translator instance
11 12 13 14 15 16 |
# File 'lib/translatomatic/translator/google.rb', line 11 def initialize( = {}) super() key = [:google_api_key] || ENV["GOOGLE_API_KEY"] raise "google api key required" if key.nil? EasyTranslate.api_key = key end |
Instance Method Details
#languages ⇒ Array<String>
Returns A list of languages supported by this translator.
19 20 21 |
# File 'lib/translatomatic/translator/google.rb', line 19 def languages EasyTranslate::LANGUAGES.keys end |