Class: Trinity::Application

Inherits:
Trinity::Handler show all
Defined in:
lib/trinity/application.rb

Instance Method Summary

Methods inherited from Trinity::Handler

#call, #not_found, #query, #redirect

Constructor Details

- (Application) initialize(repository, options = {}, &block)

A new instance of Application



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/trinity/application.rb', line 4

def initialize(repository, options = {}, &block)
  this = self
  @repository  = repository
  @application = Rack::Builder.app do
    use Trinity::Handler::Initializer, repository, options
    use Trinity::Handler::Acceptor,    repository
    use Trinity::Handler::Aliaser,     repository
    use Trinity::Handler::Redirector,  repository
    use Trinity::Handler::Loader,      repository
    use Trinity::Handler::Reasoner,    repository
    map(options[:path] || '/') do
      run Trinity::Handler::Dispatcher.new(this, repository)
    end
  end
end