Module: I18n::Tasks::Command::OptionParsers::Locale::Validator
- Included in:
- ListParser, Parser
- Defined in:
- lib/i18n/tasks/command/option_parsers/locale.rb
Constant Summary collapse
- VALID_LOCALE_RE =
/\A\w[\w\-.]*\z/i.freeze
Instance Method Summary collapse
Instance Method Details
#validate!(locale) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/i18n/tasks/command/option_parsers/locale.rb', line 10 def validate!(locale) if VALID_LOCALE_RE !~ locale fail CommandError, I18n.t('i18n_tasks.cmd.errors.invalid_locale', invalid: locale) end locale end |