Class: Aspect

Inherits:
Module show all
Defined in:
lib/cuts/aop.rb

Overview

Aspect Oriented Programming for Ruby using Cuts.

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Aspect

Returns a new instance of Aspect.



11
12
13
14
# File 'lib/cuts/aop.rb', line 11

def initialize(&block)
  instance_eval(&block)
  extend self
end

Instance Method Details

#join(name, &block) ⇒ Object

TODO Should this accept pattern matches as an alternative to the block too?

Eg. join(name, pattern=nil, &block)


22
23
24
# File 'lib/cuts/aop.rb', line 22

def join(name, &block)
  (points[name] ||= []) << block
end

#pointsObject



16
17
18
# File 'lib/cuts/aop.rb', line 16

def points
  @points ||= {}
end