Module: I18n::Inflector::Config::Reserved::Kinds

Defined in:
lib/i18n-inflector/config.rb

Overview

This module contains constants defining reserved characters in kind identifiers.

Defined Under Namespace

Modules: Regexp

Constant Summary collapse

DB =

Reserved characters in kind identifiers placed in configuration.

(Operators::ALL | Markers::ALL) - [Markers::ALIAS, Markers::LOUD_VALUE]
OPTION =

Reserved characters in kind identifiers passed as option values.

DB
PATTERN =

Reserved characters in kind identifiers placed in patterns.

(Operators::ALL | Markers::ALL) - [Markers::LOUD_VALUE]

Class Method Summary collapse

Class Method Details

.invalid?(kind, root) ⇒ Boolean

This method checks if the given kind is invalid, that means it’s either nil or empty or it matches the refular expression given as root.

Parameters:

  • kind (Symbol, String)

    the identifier of a kind

  • root (Regexp)

    the regular expression used to test

Returns:

  • (Boolean)

    true if the given kind is invalid, false otherwise



249
250
251
252
253
254
255
# File 'lib/i18n-inflector/config.rb', line 249

def invalid?(kind, root)
  kind = kind.to_s
  kind.empty?                                           ||
   (root != Regexp::OPTION &&
   (KEYS[kind.to_sym] || OPTION_PREFIX_REGEXP =~ kind)) ||
  Regexp.const_get(root) =~ kind
end