Method: I18n::Inflector::API_Strict#each_token

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

#each_token(kind) ⇒ LazyHashEnumerator #each_token(kind, locale) ⇒ LazyHashEnumerator

Note:

You cannot deduce where aliases are pointing to, since the information about a target is replaced by the description. To get targets use the #raw_tokens method. To simply list aliases and their targets use the #aliases method.

Iterates through available inflection tokens belonging to a strict kind and their descriptions.

Overloads:

  • #each_token(kind) ⇒ LazyHashEnumerator

    Iterates through available inflection tokens and their descriptions for some kind and the current locale.

    Parameters:

    • kind (Symbol, String)

      the kind of inflection tokens to be returned

    Returns:

  • #each_token(kind, locale) ⇒ LazyHashEnumerator

    Iterates through available inflection tokens and their descriptions of the given kind and locale.

    Parameters:

    • kind (Symbol, String)

      the kind of inflection tokens to be returned

    • locale (Symbol)

      the locale to use

    Returns:

Yields:

  • (token, description)

    optional block in which each token will be yielded

Yield Parameters:

  • token (Symbol)

    a token

  • description (String)

    a description string for a token

Yield Returns:

Returns:

Raises:

[View source]

394
395
396
397
# File 'lib/i18n-inflector/api_strict.rb', line 394

def each_token(kind=nil, locale=nil, &block)
  kind = kind.to_s.empty? ? nil : kind.to_sym
  data_safe(locale).each_token(kind, &block)
end