Method: I18n::Inflector::API_Strict#kind

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

#kind(token, kind) ⇒ Symbol? #kind(token, kind, locale) ⇒ Symbol?

Gets a kind of the given token (which may be an alias) belonging to a strict kind.

Overloads:

  • #kind(token, kind) ⇒ Symbol?

    Uses current locale and the given kind to get a kind of the given token (which may be an alias).

    Parameters:

    • token (Symbol, String)

      name of the token or alias

    • kind (Symbol, String)

      the identifier of a kind (expectations filter)

    Returns:

    • (Symbol, nil)

      the kind of the given token or nil

  • #kind(token, kind, locale) ⇒ Symbol?

    Uses the given locale to get a kind of the given token (which may be an alias).

    Parameters:

    • token (Symbol, String)

      name of the token or alias

    • kind (Symbol, String)

      the identifier of a kind (expectations filter)

    • locale (Symbol)

      the locale to use

    Returns:

    • (Symbol, nil)

      the kind of the given token or nil

Returns:

  • (Symbol, nil)

    the kind of the given token or nil

Raises:

[View source]

365
366
367
368
# File 'lib/i18n-inflector/api_strict.rb', line 365

def kind(token, kind=nil, locale=nil)
  return nil if (token.nil? || kind.nil? || token.to_s.empty? || kind.to_s.empty?)
  data_safe(locale).get_kind(token.to_sym, kind.to_sym)
end