Method: Plugins::AroundStack#call
- Defined in:
- lib/plugins/around_stack.rb
permalink #call(*args, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/plugins/around_stack.rb', line 28 def call(*args, &block) raise Errors::Error, "Must pass block" unless block_given? call_stack = @_stack.dup inner_most = WrappedBlock.new(&block) call_stack.unshift(inner_most) outer_most = call_stack.pop outer_most.call(call_stack, *args) # This shouldn't happen unless the AroundStack isn't functioning properly. raise Errors::Error, "Block passed was not called!" unless inner_most.called? inner_most.retval end |