Class: X::CGI
- Inherits:
-
Object
- Object
- X::CGI
- Defined in:
- lib/x/cgi.rb
Class Method Summary collapse
-
.escape(value) ⇒ Object
TODO: Replace CGI.escape with CGI.escapeURIComponent when support for Ruby 3.1 is dropped.
- .escape_params(params) ⇒ Object
Class Method Details
.escape(value) ⇒ Object
TODO: Replace CGI.escape with CGI.escapeURIComponent when support for Ruby 3.1 is dropped
6 7 8 |
# File 'lib/x/cgi.rb', line 6 def self.escape(value) ::CGI.escape(value).gsub("+", "%20") end |
.escape_params(params) ⇒ Object
10 11 12 |
# File 'lib/x/cgi.rb', line 10 def self.escape_params(params) params.map { |k, v| "#{k}=#{escape(v)}" }.join("&") end |