This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Matthew Rudy Jacobs (author)
Sun Dec 14 14:31:03 -0800 2008
commit 40e42ceaa6c8da1c166f924dd61c02bde6045c71
tree 0cebd38b17e1d8eee9ca136dd27e6a22cc470954
parent 483f45f7cce9c1b38bec035ca5c84fc12e824dc0
tree 0cebd38b17e1d8eee9ca136dd27e6a22cc470954
parent 483f45f7cce9c1b38bec035ca5c84fc12e824dc0
| name | age | message | |
|---|---|---|---|
| |
README | Sat Dec 06 17:57:23 -0800 2008 | |
| |
Rakefile | Sat Dec 06 17:28:24 -0800 2008 | |
| |
aspicious.gemspec | Sun Dec 07 15:32:08 -0800 2008 | |
| |
examples/ | Sat Dec 06 17:28:24 -0800 2008 | |
| |
lib/ | Sun Dec 14 14:31:03 -0800 2008 | |
| |
rdoc/ | Sun Dec 14 13:53:02 -0800 2008 |
README
Aspicious
=====================================================
Aspicious is a lightweight, simple, implementation of Aspects into Ruby.
For a more heavy handed approach see AspectR and Aquarium.
Aspicious is based on the founding principle that "aspects" is like "suspects"
and "aspicious" is like "suspicious". So it doesnt mean anything, but nevertheless is a name.
Example
=====================================================
require 'rubygems'
require 'aspicious'
class Turtle < ActiveRecord::Base
def lay_some_eggs
puts "laying these eggs good"
end
end
class EggThief < Aspicious::Watcher
watch Turtle
after :lay_some_eggs, :try_to_steal_the_eggs
def try_to_steal_the_eggs
if watchee.is_weak?
puts "I stole the eggs"
else
puts "I didnt manage to steal the eggs. Nature is safe!"
end
end
end
but you can also "watch" multiple classes, and specify an :only option
class Chicken
def lay_some_eggs
puts "chickens lay eggs for everybody to eat"
end
end
class CorporateEggFarmer < Aspicious::Watcher
watch Turtle, Chicken
before :lay_some_eggs, :advertise_the_eggs, :only => Chicken
def advertise_the_eggs
puts "even though #{watchee.name}'s eggs aren't out yet, I'll start advertising them on TV. If Kerry Katona is
advertising them on ITV they will surely sell?"
end
end
BOOM!!!
Most of the power of Aspect Oriented Programming for 1% of the price
Copyright (c) 2008 [Matthew Rudy Jacobs], released under the MIT license







