Class: Seasar::Aop::Pointcut
- Inherits:
-
Object
- Object
- Seasar::Aop::Pointcut
- Defined in:
- lib/seasar/aop/pointcut.rb
Instance Attribute Summary collapse
-
#point ⇒ Object
Returns the value of attribute point.
Instance Method Summary collapse
-
#applicable?(method_name) ⇒ Boolean
-
args 1.
-
-
#initialize(point) ⇒ Pointcut
constructor
-
args 1.
-
Constructor Details
#initialize(point) ⇒ Pointcut
-
args
-
Regexp|Symbol|String point
-
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/seasar/aop/pointcut.rb', line 28 def initialize(point) @point = point if @point.is_a?(Regexp) @matcher = lambda {|method_name| @point.match(method_name.to_s)} elsif @point.is_a?(Symbol) @matcher = lambda {|method_name| @point.to_s == method_name.to_s} elsif @point.is_a?(String) @matcher = lambda {|method_name| @point == method_name.to_s} else raise ArgumentError.new("unsupported point class #{@point}") end end |
Instance Attribute Details
#point ⇒ Object
Returns the value of attribute point.
40 41 42 |
# File 'lib/seasar/aop/pointcut.rb', line 40 def point @point end |
Instance Method Details
#applicable?(method_name) ⇒ Boolean
-
args
-
String method_name
-
-
return
-
Boolean
-
48 49 50 |
# File 'lib/seasar/aop/pointcut.rb', line 48 def applicable?(method_name) return @matcher.call(method_name) end |