Class: Walle::Middlewares::Builder::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/walle/middlewares/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_class, app, *args, &block) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
# File 'lib/walle/middlewares/builder.rb', line 7

def initialize(target_class, app, *args, &block)
  @target_class, @app, @args, @block = target_class, app, args, block
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



5
6
7
# File 'lib/walle/middlewares/builder.rb', line 5

def app
  @app
end

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/walle/middlewares/builder.rb', line 5

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



5
6
7
# File 'lib/walle/middlewares/builder.rb', line 5

def block
  @block
end

#target_classObject (readonly)

Returns the value of attribute target_class.



5
6
7
# File 'lib/walle/middlewares/builder.rb', line 5

def target_class
  @target_class
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/walle/middlewares/builder.rb', line 11

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