Sha256: 49a4967fc41d7ccdf71d3f9c5f3d5d1b5a50a364b64d7f4d2708d62949d77c4f

Contents?: true

Size: 352 Bytes

Versions: 3

Compression:

Stored size: 352 Bytes

Contents

# -*- coding: utf-8 -*-
class Uri
  #
  def self.escape_raw(st)
    st.gsub(/([^a-zA-Z0-9_\-\.~])/) { "%#{$1.unpack('H*')[0].scan(/../).join('%').upcase }" }
  end

  #
  # usage
  # @search_tag = Uri.unescape_raw(params[:tag]).toutf8
  #
  def self.unescape_raw(st)
    st.tr('+',' ').gsub(/%([A-Fa-f0-9][A-Fa-f0-9])/) { [$1.hex].pack('C') }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
keystone-0.0.32 lib/keystone/core_ext/uri.rb
keystone-0.0.31 lib/keystone/core_ext/uri.rb
keystone-0.0.30 lib/keystone/core_ext/uri.rb