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.



93
94
95
# File 'lib/i18n-inflector/errors.rb', line 93

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

Instance Method Details

#messageObject



97
98
99
100
101
102
103
104
# File 'lib/i18n-inflector/errors.rb', line 97

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