class Ribbon::Plugins::AroundStack::AroundWrapper
Attributes
block[R]
stack[R]
subject[R]
Public Class Methods
new(stack, subject, &block)
click to toggle source
# File lib/ribbon/plugins/around_stack.rb, line 47 def initialize(stack, subject, &block) @stack = stack @subject = subject @block = block end
Public Instance Methods
call(call_stack, *args)
click to toggle source
# File lib/ribbon/plugins/around_stack.rb, line 62 def call(call_stack, *args) wrapped = call_stack.pop raise Errors::Error, 'call stack too short' unless wrapped define_singleton_method("perform_#{subject}") { |*new_args| args = new_args unless new_args.empty? wrapped.call(call_stack, *args) } singleton_class.instance_exec(subject) { |subject| alias_method subject, "perform_#{subject}" # Don't allow these to be overriden attr_reader :stack, :subject, :block } instance_exec(*args, &block) end
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/ribbon/plugins/around_stack.rb, line 57 def method_missing(meth, *args, &block) super unless scope scope.send(meth, *args, &block) end
scope()
click to toggle source
# File lib/ribbon/plugins/around_stack.rb, line 53 def scope stack.scope end