Class: Waves::Dispatchers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/waves/dispatchers/base.rb

Overview

Waves::Dispatchers::Base provides the basic request processing structure for a Rack application. It creates a Waves request, determines whether to enclose the request processing in a mutex benchmarks it, logs it, and handles redirects. Derived classes need only process the request within the safe method, which must take a Waves::Request and return a Waves::Response.

Direct Known Subclasses

Default

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

As with any Rack application, a Waves dispatcher must provide a call method that takes an env hash.



18
19
20
21
22
23
24
# File 'lib/waves/dispatchers/base.rb', line 18

def call( env )
  response = if Waves.synchronize? || Waves.debug?
    Waves.synchronize { Waves.reload ; _call( env )  }
  else
    _call( env )
  end
end

#deferred?(env) ⇒ Boolean

Called by event driven servers like thin and ebb. Returns true if the server should run the request in a separate thread.

Returns:

  • (Boolean)


28
# File 'lib/waves/dispatchers/base.rb', line 28

def deferred?( env ) ; Waves.config.resource.new( Waves::Request.new( env ) ).deferred? ; end