Method: I18n::Inflector::InflectionData#add_token

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

#add_token(token, kind, description) ⇒ Boolean

Adds a token (overwriting existing token).

Parameters:

  • token (Symbol)

    the name of a token to add

  • kind (Symbol)

    the kind of a token

  • description (String)

    the description of a token

Returns:

  • (Boolean)

    true if everything went ok, false otherwise (in case of bad names or non-existent targets)

[View source]

71
72
73
74
75
76
77
78
# File 'lib/i18n-inflector/inflection_data.rb', line 71

def add_token(token, kind, description)
  return false if (token.to_s.empty? || kind.to_s.empty? || description.nil?)
  token = token.to_sym
  @tokens[token] = {}
  @tokens[token][:kind]         = kind.to_sym
  @tokens[token][:description]  = description.to_s
  @kinds[kind] = true
end