Class: Raca::Util
- Inherits:
-
Object
- Object
- Raca::Util
- Defined in:
- lib/raca/util.rb
Overview
Misc helper methods used across the codebase
Class Method Summary collapse
-
.url_encode(str) ⇒ Object
CGI.escape, but without special treatment on spaces.
Class Method Details
.url_encode(str) ⇒ Object
CGI.escape, but without special treatment on spaces
5 6 7 8 9 |
# File 'lib/raca/util.rb', line 5 def self.url_encode(str) str.gsub(%r{([^a-zA-Z0-9_./-]+)}) do |match| '%' + match.unpack('H2*' * match.bytesize).join('%').upcase end end |