Object
# File lib/journey/router/utils.rb, line 48 def self.escape_fragment(fragment) Parser.escape(fragment.to_s, UriEscape::UNSAFE_FRAGMENT) end
# File lib/journey/router/utils.rb, line 44 def self.escape_path(path) Parser.escape(path.to_s, UriEscape::UNSAFE_SEGMENT) 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 def self.normalize_path(path) path = "/#{path}" path.squeeze!('/') path.sub!(%{/+\Z}, '') path = '/' if path == '' path end
Generated with the Darkfish Rdoc Generator 2.