Class: Knot::Application::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/knot/application/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
# File 'lib/knot/application/configuration.rb', line 6

def initialize
  handle(:not_found) { "Aw snap" }
  handle(:internal_error) { "Error!?" }
end

Instance Attribute Details

#template_pathObject



19
20
21
# File 'lib/knot/application/configuration.rb', line 19

def template_path
  @template_path ||= "templates/"
end

Instance Method Details

#_handlersObject



27
28
29
# File 'lib/knot/application/configuration.rb', line 27

def _handlers
  @_handlers ||= {}
end

#add_router(router) ⇒ Object



11
12
13
# File 'lib/knot/application/configuration.rb', line 11

def add_router(router)
  routers << router
end

#finalize!Object



31
32
33
34
35
# File 'lib/knot/application/configuration.rb', line 31

def finalize!
  routers.each do |router|
    router.config.knot_template_home = template_path
  end
end

#handle(type, &block) ⇒ Object



23
24
25
# File 'lib/knot/application/configuration.rb', line 23

def handle(type, &block)
  _handlers[type] = Knot::Dispatch::Route.new("", "", "", &block)
end

#routersObject



15
16
17
# File 'lib/knot/application/configuration.rb', line 15

def routers
  @routers ||= []
end