Module Aspects
In: lib/facets/more/aspects.rb

Add support for Aspect Oriented Programming (AOP).

Examples

class Controller

  pre :force_login, :where => :prepend
  wrap Benchmark, :on => :index
  post :taraa, :on => login

end

module Timestamped

  pre :on => :og_insert { |this| this.create_time = Time.now }
  pre :on => :og_update { |this| this.update_time = Time.now }
  pre :on => [:og_insert, :og_update] { |this| this.create_time = Time.now }

end

Methods

Constants

Advice = Struct.new(:code, :options)   Store the code and the metadata (options) for an Advice.

External Aliases

wrap -> apply_advices

Public Class methods

Include Modules that define advices.

Apply the advices to the target class.

[Validate]