class KeyError
Raised when the specified key is not found. It is a subclass of IndexError.
h = {"foo" => :bar} h.fetch("foo") #=> :bar h.fetch("baz") #=> KeyError: key not found: "baz"
Public Class Methods
Public Instance Methods
() → K?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/errors.rbs, line 170
def key: () -> K?
Return the key caused this KeyError exception.