62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/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}"
attr_reader :stack, :subject, :block
}
instance_exec(*args, &block)
end
|