Module: C3po::Translator
- Included in:
- C3po
- Defined in:
- lib/c3po.rb,
lib/c3po/translator.rb,
lib/c3po/translator/bing.rb,
lib/c3po/translator/google.rb,
lib/c3po/translator/result.rb,
lib/c3po/translator/configuration.rb
Defined Under Namespace
Classes: Bing, Configuration, Google, Result
Instance Method Summary collapse
-
#is ⇒ String
Identify language.
-
#is?(language) ⇒ Boolean
Check language.
-
#languages ⇒ Array
Grab languages list from provider.
-
#translate(from, to) ⇒ String
Translate a string.
Instance Method Details
#is ⇒ String
Identify language.
46 47 48 |
# File 'lib/c3po/translator.rb', line 46 def is @result.language ||= fetch @adaptor.build_detect_query end |
#is?(language) ⇒ Boolean
Check language.
62 63 64 |
# File 'lib/c3po/translator.rb', line 62 def is?(language) language.to_s == is end |
#languages ⇒ Array
Grab languages list from provider.
32 33 34 |
# File 'lib/c3po/translator.rb', line 32 def languages @result.languages ||= fetch @adaptor.build_languages_query end |
#translate(from, to) ⇒ String
Translate a string.
18 19 20 |
# File 'lib/c3po/translator.rb', line 18 def translate(from, to) @result.translation ||= fetch @adaptor.build_query(from, to) end |