Class: Joinpoint
- Inherits:
-
Object
- Object
- Joinpoint
- Defined in:
- lib/cuts/aop.rb
Instance Method Summary collapse
- #==(sym) ⇒ Object
- #===(match) ⇒ Object
-
#initialize(object, base, method, *args, &block) ⇒ Joinpoint
constructor
A new instance of Joinpoint.
- #super ⇒ Object
Constructor Details
#initialize(object, base, method, *args, &block) ⇒ Joinpoint
Returns a new instance of Joinpoint.
44 45 46 47 48 49 50 |
# File 'lib/cuts/aop.rb', line 44 def initialize(object, base, method, *args, &block) @object = object @base = base @method = method @args = args @block = block end |
Instance Method Details
#==(sym) ⇒ Object
61 62 63 |
# File 'lib/cuts/aop.rb', line 61 def ==(sym) sym.to_sym == @method.to_sym end |
#===(match) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/cuts/aop.rb', line 52 def ===(match) case match when Proc match.call(self) else # Pattern matches (not supported presently) match.to_sym == @method.to_sym end end |
#super ⇒ Object
67 68 69 70 |
# File 'lib/cuts/aop.rb', line 67 def super anc = @object.class.ancestors.find{ |anc| anc.method_defined?(@method) } anc.instance_method(@method).bind(@object).call(*@args, &@block) end |