Class: Pendragon::Padrino::Router
- Defined in:
- lib/pendragon/padrino/router.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Attributes inherited from Router
Instance Method Summary collapse
Methods inherited from Router
#delete, #get, #head, #increment_order!, #initialize, #invoke, #post, #prepare!, #prepared?, #put, #recognize, #recognize_path, #reset!
Constructor Details
This class inherits a constructor from Pendragon::Router
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/pendragon/padrino/router.rb', line 6 def configuration @configuration end |
Instance Method Details
#add(verb, path, options = {}, &block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/pendragon/padrino/router.rb', line 8 def add(verb, path, = {}, &block) route = Route.new(path, verb, , &block) route.path_for_generation = [:path_for_generation] if [:path_for_generation] route.router = self routes << route route end |
#call(env) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/pendragon/padrino/router.rb', line 16 def call(env) request = Rack::Request.new(env) [200, {}, recognize(request)] rescue BadRequest, NotFound, MethodNotAllowed $!.call end |
#path(name, *args) ⇒ Object
23 24 25 26 27 |
# File 'lib/pendragon/padrino/router.rb', line 23 def path(name, *args) extract_with(name, *args) do |route, params, matcher| matcher.mustermann? ? matcher.(params) : route.path_for_generation end end |