Class: Rack::Mount::Mappers::Merb::DeferredProc

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/mount/mappers/merb.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, deferred_procs) ⇒ DeferredProc

Returns a new instance of DeferredProc.



47
48
49
# File 'lib/rack/mount/mappers/merb.rb', line 47

def initialize(app, deferred_procs)
  @app, @proc = app, deferred_procs.cache
end

Instance Method Details

#call(env) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/rack/mount/mappers/merb.rb', line 51

def call(env)
  # TODO: Change this to a Merb request
  request = Rack::Request.new(env)
  params  = env[Const::RACK_ROUTING_ARGS]
  result  = @proc.call(request, params)

  if result
    @app.call(env)
  else
    Const::NOT_FOUND_RESPONSE
  end
end