Sha256: 71169e4088ce1a7c1c655d2727c576da8c180f660c12405dc9a16dbf2e853b04
Contents?: true
Size: 923 Bytes
Versions: 7
Compression:
Stored size: 923 Bytes
Contents
# -*- coding: utf-8 -*- require 'rack/utils' require 'singleton' module Jpmobile module Rack module_function def mount_middlewares # 漢字コード・絵文字フィルター ::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::ParamsFilter) ::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::Filter) end end end module Rack class Request def params self.GET.merge(self.POST) end end # UTF-8 で match させるようにする module Utils def escape(s) s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/) { '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase }.tr(' ', '+') end module_function :escape def unescape(s) s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/){ [$1.delete('%')].pack('H*') } end module_function :unescape end end
Version data entries
7 entries across 7 versions & 1 rubygems