Object
# File lib/journey/router/utils.rb, line 48 48: def self.escape_fragment(fragment) 49: Parser.escape(fragment.to_s, UriEscape::UNSAFE_FRAGMENT) 50: end
# File lib/journey/router/utils.rb, line 44 44: def self.escape_path(path) 45: Parser.escape(path.to_s, UriEscape::UNSAFE_SEGMENT) 46: end
Normalizes URI path.
Strips off trailing slash and ensures there is a leading slash.
normalize_path("/foo") # => "/foo" normalize_path("/foo/") # => "/foo" normalize_path("foo") # => "/foo" normalize_path("") # => "/"
# File lib/journey/router/utils.rb, line 14 14: def self.normalize_path(path) 15: path = "/#{path}" 16: path.squeeze!('/') 17: path.sub!(%{/+\Z}, '') 18: path = '/' if path == '' 19: path 20: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.