Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

URI::RFC2396_Parser#escape

(::String str, ?::Regexp unsafe) -> ::String
escape( str )
escape( str, unsafe )

Args

str

String to make safe

unsafe

Regexp to apply. Defaults to self.regexp[:UNSAFE]

Description

Constructs a safe String from str, removing unsafe characters, replacing them with codes.

See also #convert_to_uri #extract .new #initialize_pattern also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0