Module: Lab42::AOP

Extended by:
AOP
Included in:
AOP
Defined in:
lib/lab42/aop.rb,
lib/lab42/aop/meta.rb,
lib/lab42/aop/after.rb,
lib/lab42/aop/tools.rb,
lib/lab42/aop/around.rb,
lib/lab42/aop/before.rb,
lib/lab42/aop/version.rb,
lib/lab42/aop/param_filter.rb,
lib/lab42/aop/cross_concern.rb,
lib/lab42/aop/result_filter.rb

Defined Under Namespace

Modules: After, Around, Before, CrossConcern, Meta, ParamFilter, ResultFilter, Tools

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Instance Method Details

#_scopesObject



61
# File 'lib/lab42/aop.rb', line 61

def _scopes; @__scopes__ ||= [] end

#after(*args, **kwds, &blk) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/lab42/aop.rb', line 16

def after *args, **kwds, &blk
  if blk
    After.with_block( self, *args, **kwds, &blk )
  else
    After.with_methods( self, *args, **kwds )
  end
end

#around(*args, **kwds, &blk) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/lab42/aop.rb', line 23

def around *args, **kwds, &blk
  if blk
    Around.with_block( self, *args, **kwds, &blk )
  else
    Around.with_methods( self, *args, **kwds )
  end
end

#before(*args, **kwds, &blk) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/lab42/aop.rb', line 30

def before *args, **kwds, &blk
  if blk
    Before.with_block( self, *args, **kwds, &blk )
  else
    Before.with_methods( self, *args, **kwds )
  end
end

#param_filter(*args, **kwds, &blk) ⇒ Object

def concern_scope &blk

_scopes << Module.new(&blk) # Just to know the methods defined
module_eval &blk

ensure

_scopes.pop

end



45
46
47
48
49
50
51
# File 'lib/lab42/aop.rb', line 45

def param_filter *args, **kwds, &blk
  if blk
    ParamFilter.with_block( self, *args, **kwds, &blk )
  else
    ParamFilter.with_methods( self, *args, **kwds )
  end
end

#result_filter(*args, **kwds, &blk) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/lab42/aop.rb', line 53

def result_filter *args, **kwds, &blk
  if blk
    ResultFilter.with_block( self, *args, **kwds, &blk )
  else
    ResultFilter.with_methods( self, *args, **kwds, &blk )
  end
end