Class: Starcall::Languages
- Inherits:
-
Object
- Object
- Starcall::Languages
- Defined in:
- lib/starcall/languages.rb
Overview
This class is used to list and validate languages.
Class Method Summary collapse
-
.list ⇒ Object
A list of valid Riot Languages.
-
.valid?(language:) ⇒ Boolean
A method to check is the language is valid, if not, raise an error.
Class Method Details
.list ⇒ Object
A list of valid Riot Languages. rubocop:disable Metrics/MethodLength
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/starcall/languages.rb', line 8 def self.list [ 'cs_CZ', # Czech (Czech Republic) 'el_GR', # Greek (Greece) 'pl_PL', # Polish (Poland) 'ro_RO', # Romanian (Romania) 'hu_HU', # Hungarian (Hungary) 'en_GB', # English (United Kingdom) 'de_DE', # German (Germany) 'es_ES', # Spanish (Spain) 'it_IT', # Italian (Italy) 'fr_FR', # French (France) 'ja_JP', # Japanese (Japan) 'ko_KR', # Korean (Korea) 'es_MX', # Spanish (Mexico) 'es_AR', # Spanish (Argentina) 'pt_BR', # Portuguese (Brazil) 'en_US', # English (United States) 'en_AU', # English (Australia) 'ru_RU', # Russian (Russia) 'tr_TR', # Turkish (Turkey) 'ms_MY', # Malay (Malaysia) 'en_PH', # English (Republic of the Philippines) 'en_SG', # English (Singapore) 'th_TH', # Thai (Thailand) 'vn_VN', # Vietnamese (Viet Nam) 'id_ID', # Indonesian (Indonesia) 'zh_MY', # Chinese (Malaysia) 'zh_CN', # Chinese (China) 'zh_TW' # Chinese (Taiwan) ] end |
.valid?(language:) ⇒ Boolean
A method to check is the language is valid, if not, raise an error.
43 44 45 46 47 |
# File 'lib/starcall/languages.rb', line 43 def self.valid?(language:) return true if list.include? language raise Starcall::Errors::InvalidLanguage.new(language: language) end |