Class: I18n::BadInflectionToken

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

Overview

This is raised when an inflection token or its description has a bad name. This includes an empty name or a name containing prohibited characters.

Instance Attribute Summary collapse

Attributes inherited from InflectionConfigurationException

#locale

Attributes inherited from InflectionException

#key, #kind, #token

Instance Method Summary collapse

Constructor Details

#initialize(locale, token, kind = nil, description = nil) ⇒ BadInflectionToken

Returns a new instance of BadInflectionToken.



229
230
231
232
# File 'lib/i18n-inflector/errors.rb', line 229

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

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



227
228
229
# File 'lib/i18n-inflector/errors.rb', line 227

def description
  @description
end

Instance Method Details

#messageObject



234
235
236
237
238
239
240
241
242
243
244
# File 'lib/i18n-inflector/errors.rb', line 234

def message
  if @description.nil?
    "" << super <<
    "inflection token #{@token.inspect} " \
    "has a bad name"
  else
    "" << super <<
    "inflection token #{@token.inspect} " \
    "has a bad description #{@description.inspect}"
  end
end