class Middlestack::Stack::Proxy

Attributes

app[R]
args[R]
block[R]
target_class[R]

Public Class Methods

new(target_class, app, *args, &block) click to toggle source
# File lib/middlestack/stack.rb, line 6
def initialize(target_class, app, *args, &block)
  @target_class, @app, @args, @block = target_class, app, args, block
end

Public Instance Methods

call(env) click to toggle source
# File lib/middlestack/stack.rb, line 10
def call(env)
  with_env(env) do |target|
    target.before if target.respond_to?(:before)
    app.call(env)
    target.after if target.respond_to?(:after)
  end
end

Private Instance Methods

with_env(env) { |target_class(env, *args, &block)| ... } click to toggle source
# File lib/middlestack/stack.rb, line 20
def with_env(env)
  yield target_class.new(env, *args, &block)
end