Class: Mustermann::Router::Rack
- Inherits:
-
Simple
- Object
- Pattern
- Mustermann::RegexpBased
- Simple
- Mustermann::Router::Rack
- Defined in:
- lib/mustermann/router/rack.rb
Overview
Simple pattern based router that allows matching paths to a given Rack application.
Constant Summary
Constants inherited from Pattern
Constants included from Mustermann
Instance Attribute Summary
Attributes inherited from Mustermann::RegexpBased
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Rack
constructor
A new instance of Rack.
Methods inherited from Mustermann::RegexpBased
Methods inherited from Pattern
#&, #===, #=~, #^, #expand, #match, #named_captures, #names, new, #params, #peek, #peek_match, #peek_params, #peek_size, supported?, supported_options, #to_proc, #to_s, #to_templates, #|
Methods included from Mustermann
Constructor Details
#initialize(options = {}, &block) ⇒ Rack
Returns a new instance of Rack.
24 25 26 27 28 29 30 31 |
# File 'lib/mustermann/router/rack.rb', line 24 def initialize( = {}, &block) env_prefix = .delete(:env_prefix) || "mustermann" params_key = .delete(:params_key) || "#{env_prefix}.params" pattern_key = .delete(:pattern_key) || "#{env_prefix}.pattern" @params_key, @pattern_key = params_key, pattern_key [:default] = [404, {"Content-Type" => "text/plain", "X-Cascade" => "pass"}, ["Not Found"]] unless .include? :default super(, &block) end |