Class: Praxis::Router::RequestRouter

Inherits:
Mustermann::Router::Simple show all
Defined in:
lib/praxis/router.rb

Instance Attribute Summary

Attributes inherited from Mustermann::Router::Simple

#default

Instance Method Summary collapse

Methods inherited from Mustermann::Router::Simple

#[], #[]=, #call, #on

Constructor Details

#initialize(**options, &block) ⇒ RequestRouter

Returns a new instance of RequestRouter.



27
28
29
30
31
# File 'lib/praxis/router.rb', line 27

def initialize(**options, &block)
  options[:default] = :not_found

  super(**options, &block)
end

Instance Method Details

#invoke(callback, request, params, _pattern) ⇒ Object



33
34
35
36
# File 'lib/praxis/router.rb', line 33

def invoke(callback, request, params, _pattern)
  request.route_params = params
  callback.call(request)
end

#string_for(request) ⇒ Object



38
39
40
# File 'lib/praxis/router.rb', line 38

def string_for(request)
  request.path
end