Module | Rack::Mount::Utils |
In: |
lib/rack/mount/utils.rb
|
Private utility methods used throughout Rack::Mount.
RESERVED_PCHAR | = | ':@&=+$,;%' |
SAFE_PCHAR | = | "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}" |
UNSAFE_PCHAR | = | Regexp.new("[^#{SAFE_PCHAR}]", false).freeze |
UNSAFE_PCHAR | = | Regexp.new("[^#{SAFE_PCHAR}]", false, 'N').freeze |
Parser | = | URI.const_defined?(:Parser) ? URI::Parser.new : URI |
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("") # => "/"
Removes trailing nils from array.
pop_trailing_blanks!([1, 2, 3]) # => [1, 2, 3] pop_trailing_blanks!([1, 2, 3, nil, ""]) # => [1, 2, 3] pop_trailing_blanks!([nil]) # => [] pop_trailing_blanks!([""]) # => []