class Fog::Storage::Brightbox

Public Class Methods

escape(str, extra_exclude_chars = "") click to toggle source

CGI.escape, but without special treatment on spaces

# File lib/fog/brightbox/storage.rb, line 156
def self.escape(str, extra_exclude_chars = "")
  str.gsub(/([^a-zA-Z0-9_.-#{extra_exclude_chars}]+)/) do
    "%" + Regexp.last_match[1].unpack("H2" * Regexp.last_match[1].bytesize).join("%").upcase
  end
end