Class: Joinpoint
- Inherits:
-
Object
- Object
- Joinpoint
- Defined in:
- lib/cuts/aop.rb
Overview
A join-point is a call of a method: the object, its class, the method's name and the arguments.
TODO: Can JointPoint and Target be the same class?
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
The arguments of the call.
-
#base ⇒ Object
readonly
The class the aspect was applied to.
-
#method ⇒ Object
readonly
The name of the method.
-
#object ⇒ Object
readonly
The object the method was called on.
Instance Method Summary collapse
- #==(sym) ⇒ Object
- #===(match) ⇒ Object
-
#initialize(object, base, method, *args, &proceed) ⇒ Joinpoint
constructor
The block is what calls the method itself.
-
#name ⇒ Object
The name of the method.
-
#super ⇒ Object
(also: #call)
Call the method itself.
Constructor Details
#initialize(object, base, method, *args, &proceed) ⇒ Joinpoint
The block is what calls the method itself.
72 73 74 75 76 77 78 |
# File 'lib/cuts/aop.rb', line 72 def initialize(object, base, method, *args, &proceed) @object = object @base = base @method = method @args = args @proceed = proceed end |
Instance Attribute Details
#args ⇒ Object (readonly)
The arguments of the call.
69 70 71 |
# File 'lib/cuts/aop.rb', line 69 def args @args end |
#base ⇒ Object (readonly)
The class the aspect was applied to.
63 64 65 |
# File 'lib/cuts/aop.rb', line 63 def base @base end |
#method ⇒ Object (readonly)
The name of the method.
66 67 68 |
# File 'lib/cuts/aop.rb', line 66 def method @method end |
#object ⇒ Object (readonly)
The object the method was called on.
60 61 62 |
# File 'lib/cuts/aop.rb', line 60 def object @object end |
Instance Method Details
#==(sym) ⇒ Object
94 95 96 |
# File 'lib/cuts/aop.rb', line 94 def ==(sym) sym.to_sym == @method.to_sym end |
#===(match) ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/cuts/aop.rb', line 85 def ===(match) case match when Proc match.call(self) else # Pattern matches (not supported presently) match.to_sym == @method.to_sym end end |
#name ⇒ Object
The name of the method.
81 82 83 |
# File 'lib/cuts/aop.rb', line 81 def name @method.to_sym end |
#super ⇒ Object Also known as: call
Call the method itself.
99 100 101 |
# File 'lib/cuts/aop.rb', line 99 def super @proceed.call end |