0.0
No commit activity in last 3 years
No release in over 3 years
Simple AOP library for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 0.7.9
~> 10.0
~> 3.2
 Project Readme

Build Status Maintainability Test Coverage

YouAreDaChef

A Ruby implementation of an YouAreDaChef library inspired by https://github.com/raganwald/YouAreDaChef. This library supports before, after and around methods.

Installation

Add this line to your application's Gemfile:

gem 'YouAreDaChef'

And then execute:

$ bundle

Or install it yourself as:

$ gem install YouAreDaChef

Usage

class Glue
  extend YouAreDaChef

  attr_reader :use_case

  def initialize
    @use_case = UseCase.new
  end

  def assigned
  end

  def assessed
  end

  around :assigned, proc { |method, args|
    method.call(*args)
    # some code
  }

  before :assessed, proc { |args, object|
    object.use_case.clean_up_old_assessments
    # some code
  }

  after :assessed, proc { |args, object, result|
    object.use_case.send_email_notification
    # some code
  }
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/brissenden/YouAreDaChef.