RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

TinyHooks has been released

I just released a TinyHooks, a helper library to easily define hooks for your classes and modules. If you’re a gem author, please try it out or read the code (only 64 lines!) and give some feedback!

Comments

Is this like an alternative to ActiveSupport callbacks?

TinyHooks is similar to ActuveSupport::Callbacks, but there are a few major differences.

  • TinyHooks doesn’t support halting, but will support in the future.
  • While ActiveSupport::Callbacks has a set of methods for callbacks to work, TinyHooks has only one method.
  • You can apply callbacks/hooks into any existing methods without any changes with TinyHooks, while you need to change methods to call run_callbacks method within them to apply callbacks with ActiveSupport::Callbacks.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in