Exception: KeyError

Inherits:
IndexError
  • Object
show all
Defined in:
lib/i18n/string.rb,
lib/i18n/exceptions.rb

Overview

KeyError is raised by String#% when the string contains a named placeholder that is not contained in the given arguments hash. Ruby 1.9 includes and raises this exception natively. We define it to mimic Ruby 1.9’s behaviour in Ruby 1.8.x

Instance Method Summary collapse

Constructor Details

#initialize(message = nil) ⇒ KeyError

Returns a new instance of KeyError.



16
17
18
# File 'lib/i18n/string.rb', line 16

def initialize(message = nil)
  super(message || "key not found")
end