Class: ActionDispatch::Journey::Router::Utils::UriEncoder
- Inherits:
-
Object
- Object
- ActionDispatch::Journey::Router::Utils::UriEncoder
- Defined in:
- lib/action_dispatch/journey/router/utils.rb
Overview
URI path and fragment escaping tools.ietf.org/html/rfc3986
Constant Summary collapse
- ENCODE =
:nodoc:
"%%%02X".freeze
- US_ASCII =
Encoding::US_ASCII
- UTF_8 =
Encoding::UTF_8
- EMPTY =
"".dup.force_encoding(US_ASCII).freeze
- DEC2HEX =
(0..255).to_a.map { |i| ENCODE % i }.map { |s| s.force_encoding(US_ASCII) }
- ALPHA =
"a-zA-Z".freeze
- DIGIT =
"0-9".freeze
- UNRESERVED =
"#{ALPHA}#{DIGIT}\\-\\._~".freeze
- SUB_DELIMS =
"!\\$&'\\(\\)\\*\\+,;=".freeze
- ESCAPED =
/%[a-zA-Z0-9]{2}/.freeze
- FRAGMENT =
/[^#{UNRESERVED}#{SUB_DELIMS}:@\/\?]/.freeze
- SEGMENT =
/[^#{UNRESERVED}#{SUB_DELIMS}:@]/.freeze
- PATH =
/[^#{UNRESERVED}#{SUB_DELIMS}:@\/]/.freeze
Instance Method Summary collapse
- #escape_fragment(fragment) ⇒ Object
- #escape_path(path) ⇒ Object
- #escape_segment(segment) ⇒ Object
- #unescape_uri(uri) ⇒ Object
Instance Method Details
#escape_fragment(fragment) ⇒ Object
49 50 51 |
# File 'lib/action_dispatch/journey/router/utils.rb', line 49 def escape_fragment(fragment) escape(fragment, FRAGMENT) end |
#escape_path(path) ⇒ Object
53 54 55 |
# File 'lib/action_dispatch/journey/router/utils.rb', line 53 def escape_path(path) escape(path, PATH) end |
#escape_segment(segment) ⇒ Object
57 58 59 |
# File 'lib/action_dispatch/journey/router/utils.rb', line 57 def escape_segment(segment) escape(segment, SEGMENT) end |