Class: Knot::Application::Configuration
- Inherits:
-
Object
- Object
- Knot::Application::Configuration
- Defined in:
- lib/knot/application/configuration.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #_handlers ⇒ Object
- #add_router(router) ⇒ Object
- #finalize! ⇒ Object
- #handle(type, &block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #routers ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_path ⇒ Object
19 20 21 |
# File 'lib/knot/application/configuration.rb', line 19 def template_path @template_path ||= "templates/" end |
Instance Method Details
#_handlers ⇒ Object
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 |
#routers ⇒ Object
15 16 17 |
# File 'lib/knot/application/configuration.rb', line 15 def routers @routers ||= [] end |