module Roda::RodaPlugins::PathRewriter::ClassMethods
Public Instance Methods
Source
# File lib/roda/plugins/path_rewriter.rb, line 57 def freeze opts[:remaining_path_rewrites].freeze opts[:path_info_rewrites].freeze super end
Freeze the path rewrite metadata.
Calls superclass method
Source
# File lib/roda/plugins/path_rewriter.rb, line 65 def rewrite_path(was, is = nil, opts=OPTS, &block) if is.is_a? Hash raise RodaError, "cannot provide two hashes to rewrite_path" unless opts.empty? opts = is is = nil end if block raise RodaError, "cannot provide both block and string replacement to rewrite_path" if is is = block end was = /\A#{Regexp.escape(was)}/ unless was.is_a?(Regexp) array = @opts[opts[:path_info] ? :path_info_rewrites : :remaining_path_rewrites] array << [was, is.dup.freeze].freeze end
Record a path rewrite from path was
to path is
. Options:
- :path_info
-
Modify PATH_INFO, not just remaining path.