Class: Raca::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/raca/util.rb

Overview

Misc helper methods used across the codebase

Class Method Summary collapse

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('H*').first.scan(/../).join("%").upcase
  end
end