Class: YandexSpeechApi::Language
- Inherits:
-
Object
- Object
- YandexSpeechApi::Language
- Defined in:
- lib/yandex_speech/language.rb
Overview
no-doc
Defined Under Namespace
Classes: UnknownLanguageError
Instance Attribute Summary collapse
- #language ⇒ Symbol readonly
Class Method Summary collapse
-
.allowed_languages ⇒ Array<Classes>
List of allowed languages.
-
.codes ⇒ Object
no-doc.
Instance Method Summary collapse
- #code ⇒ String
-
#initialize(language) ⇒ Language
constructor
Creates new object instance.
Constructor Details
#initialize(language) ⇒ Language
Creates new object instance.
45 46 47 48 49 50 51 |
# File 'lib/yandex_speech/language.rb', line 45 def initialize(language) @language = language.downcase.to_sym unless Language.allowed_languages.include? @language raise UnknownLanguageError, @language end end |
Instance Attribute Details
#language ⇒ Symbol (readonly)
26 27 28 |
# File 'lib/yandex_speech/language.rb', line 26 def language @language end |
Class Method Details
.allowed_languages ⇒ Array<Classes>
List of allowed languages
11 12 13 |
# File 'lib/yandex_speech/language.rb', line 11 def self.allowed_languages @cached_list ||= Array(codes.keys) end |
.codes ⇒ Object
no-doc
15 16 17 18 19 20 21 22 |
# File 'lib/yandex_speech/language.rb', line 15 def self.codes # no-doc { english: 'en-US', russian: 'ru‑RU', turkey: 'tr-TR', ukrain: 'uk-UK', } end |