Module: I18n::Inflector::Config::Reserved::Tokens

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

Overview

This module contains constants defining reserved characters in token identifiers.

Defined Under Namespace

Modules: Regexp

Constant Summary collapse

DB =

Reserved characters in token identifiers placed in configuration.

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

Reserved characters in token identifiers passed as options.

DB
PATTERN =

Reserved characters in token identifiers placed in patterns.

OPTION - [Operators::Tokens::WILDCARD]

Class Method Summary collapse

Class Method Details

.invalid?(token, root) ⇒ Boolean

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

Parameters:

  • token (Symbol, String)

    the identifier of a token

  • root (Regexp)

    the regular expression used to test

Returns:

  • (Boolean)

    true if the given token is invalid, false otherwise



201
202
203
204
205
206
# File 'lib/i18n-inflector/config.rb', line 201

def invalid?(token, root)
  token = token.to_s
  token.empty?                                          ||
  (root == Regexp::PATTERN && Keys::ALL[token.to_sym])  ||
  Regexp.const_get(root) =~ token
end