This rule represents the invocation of a method on the ‘parent’ (a stack element below the topmost element) on the ‘child’ (the topmost stack element).
Methods
Public Class methods
Create a new invoke-parent rule. Allowed parameters are ‘method’ (which names the method of the parent to call), and ‘depth’ (which defaults to 1 and identifies how deep into the stack to dig to find the parent).
[ show source ]
# File lib/copland/rule-engine.rb, line 145
145: def initialize( parms )
146: @method_name = parms['method']
147: @depth = ( parms['depth'] || 1 ).to_i
148: end
Public Instance methods
invokes the requested method on the parent, passing the child as the only parameter.
[ show source ]
# File lib/copland/rule-engine.rb, line 151
151: def begin( processor, name, content )
152: parent = processor.stack[ -(@depth+1) ]
153: child = processor.stack.last
154:
155: parent.__send__( @method_name, child )
156: end