Module: YandexDictionary
- Defined in:
- lib/yandex_dictionary.rb,
lib/yandex_dictionary/secrets.rb,
lib/yandex_dictionary/yandex_dictionary_api.rb,
lib/yandex_dictionary/responce_parse_service.rb,
lib/yandex_dictionary/yandex_dictionary_request.rb
Defined Under Namespace
Classes: ResponceParseService, Secrets, YandexDictionaryApi, YandexDictionaryRequest
Class Method Summary collapse
Class Method Details
.get_languages ⇒ Object
15 16 17 |
# File 'lib/yandex_dictionary.rb', line 15 def self.get_languages ResponceParseService.parse_languages(YandexDictionaryApi.get_directions) end |
.translate(text, from, to) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/yandex_dictionary.rb', line 7 def self.translate(text, from, to) if text.scan(/ /).count > 0 raise 'Text for translation should be one word' else ResponceParseService.parse_translation(YandexDictionaryApi.translate(text, from, to)) end end |