Class: I18n::InvalidInflectionToken

Inherits:
InflectionPatternException show all
Defined in:
lib/i18n-inflector/errors.rb

Overview

This is raised when a token given in a pattern is invalid (empty or has no kind assigned).

Instance Attribute Summary

Attributes inherited from InflectionPatternException

#pattern

Attributes inherited from InflectionException

#key, #kind, #token

Instance Method Summary collapse

Constructor Details

#initialize(locale, pattern, token, kind = nil) ⇒ InvalidInflectionToken

Returns a new instance of InvalidInflectionToken.



106
107
108
# File 'lib/i18n-inflector/errors.rb', line 106

def initialize(locale, pattern, token, kind=nil)
  super(locale, pattern, token, kind)
end

Instance Method Details

#messageObject



110
111
112
113
114
115
116
117
# File 'lib/i18n-inflector/errors.rb', line 110

def message
  badkind = ""
  if (!@token.to_s.empty? && !kind.nil?)
    kind = @kind.to_s.empty? ? "" : @kind.to_sym
    badkind = " (processed kind: #{kind.inspect})"
  end
  "" << super << "token #{@token.to_s.inspect} is invalid" + badkind
end