How does one use rescue in Ruby without the begin and end block

error-handling, exception, rescue, ruby

Solution

A method "def" can serve as a "begin" statement:

def foo
  ...
rescue
  ...
end

Problem

I know of the standard technique of having a `begin <some code> rescue <rescue code> end` How does one just use the `rescue` block on its own? How does it work, and how does it know which code is being monitored?

Original source