Method: I18n::Inflector::InflectionData#has_token?

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

#has_token(token) ⇒ Boolean #has_token(token, kind) ⇒ Boolean

Tests if a token (or alias) is present.

Overloads:

  • #has_token(token) ⇒ Boolean

    Tests if a token (or alias) is present.

    Parameters:

    • token (Symbol)

      the identifier of a token

    Returns:

    • (Boolean)

      true if the given token (which may be an alias) exists

  • #has_token(token, kind) ⇒ Boolean

    Tests if a token (or alias) is present. The kind will work as the expectation filter.

    Parameters:

    • token (Symbol)

      the identifier of a token

    • kind (Symbol)

      the identifier of a kind

    Returns:

    • (Boolean)

      true if the given token (which may be an alias) exists and if kind of the given kind

[View source]

117
118
119
120
# File 'lib/i18n-inflector/inflection_data.rb', line 117

def has_token?(token, kind=nil)
  k = @tokens[token][:kind]
  kind.nil? ? !k.nil? : k == kind
end