Method: I18n::Inflector::API_Strict#default_token

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

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

Reads default token of the given strict kind.

Overloads:

  • #default_token(kind) ⇒ Symbol?

    This method reads default token of the given kind and the current locale.

    Parameters:

    • kind (Symbol, String)

      the kind of tokens

    Returns:

    • (Symbol, nil)

      the default token or nil if there is no default token

  • #default_token(kind, locale) ⇒ Symbol?

    This method reads default token of the given kind and the given locale.

    Parameters:

    • kind (Symbol, String)

      the kind of tokens

    • locale (Symbol)

      the locale to use

    Returns:

    • (Symbol, nil)

      the default token or nil if there is no default token

Returns:

  • (Symbol, nil)

    the default token or nil

Raises:


242
243
244
245
# File 'lib/i18n-inflector/api_strict.rb', line 242

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