Socket
Book a DemoInstallSign in
Socket

rescue-any

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rescue-any

0.1.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

RescueAny

Build Status Code Climate

An experimental library for declarative exception handling in Ruby.

Inspired by Rails's declarative rescue_from method, this is a bit of an experimental attempt to try something similar that can be used with any Ruby class, as well as to just mess around with a little meta-programming.

Usage

class RemoteUser
  include RescueAny

  rescue_any RuntimeError, on: [:create, :update, :delete], with: lambda {|ex| puts 'ohoh: ' + ex.message }

  def create
    raise RuntimeError.new("raised by #create")
  end

  def update
    raise RuntimeError.new("raised by #update")
  end

  def delete
    raise RuntimeError.new("raised by #delete")
  end
end

Contributing

Feel free to contribute or correct, just:

  • Fork this project.
  • Write specs, make them pass.
  • Updated CHANGELOG.
  • Make a pull request, bonus for topic branches.

Copyright (c) 2013, Erik Eide and Contributors.

This project is licensed under the MIT License.

FAQs

Package last updated on 14 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.