Sha256: 2f93f64268f30d98b5bbc4ee4992d8a2d16cdf9d4a38ecbdc05b9cc2f53f23ea

Contents?: true

Size: 343 Bytes

Versions: 3

Compression:

Stored size: 343 Bytes

Contents

module Jeanine
  module Rescuing
    def rescue_from(*exceptions, with: nil, &block)
      exceptions.each do |exception|
        if with
          rescue_handlers[exception] = with
        else
          rescue_handlers[exception] = block
        end
      end
    end

    def rescue_handlers
      @rescue_handlers ||= {}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jeanine-0.4.0 lib/jeanine/rescuing.rb
jeanine-0.3.0 lib/jeanine/rescuing.rb
jeanine-0.2.0 lib/jeanine/rescuing.rb