Module: Roda::RodaPlugins::PathRewriter::RequestMethods

Defined in:
lib/roda/plugins/path_rewriter.rb

Instance Method Summary collapse

Instance Method Details

#initialize(scope, env) ⇒ Object

Rewrite remaining_path and/or PATH_INFO based on the path rewrites.



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/roda/plugins/path_rewriter.rb', line 66

def initialize(scope, env)
  path_info = env[PATH_INFO]
  scope.class.opts[:path_info_rewrites].each do |was, is|
    path_info.sub!(was, is)
  end
  super
  remaining_path = @remaining_path = @remaining_path.dup
  scope.class.opts[:remaining_path_rewrites].each do |was, is|
    remaining_path.sub!(was, is)
  end
end