Sha256: 47e6f79df291ed9d2f29562999456d7711a0e1de8097246312adaef58b29f6b2
Contents?: true
Size: 507 Bytes
Versions: 5
Compression:
Stored size: 507 Bytes
Contents
module Zhima module Util def self.symbolize_hash_keys(hash) return hash.symbolize_keys! if hash.respond_to?(:symbolize_keys!) new_hash = {} hash.each do |key, value| new_hash[key.to_sym] = value end new_hash end def self.base64_encode(str) Base64.strict_encode64(str) end # 暂时只做了一级hash的处理 def self.to_query(hash) hash.map{ |k, v| [k, URI.encode_www_form_component(v)].join("=") }.join("&") end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
zhima-0.3.5 | lib/zhima/util.rb |
zhima-0.3.4 | lib/zhima/util.rb |
zhima-0.3.3 | lib/zhima/util.rb |
zhima-0.3.0 | lib/zhima/util.rb |
zhima-0.2.6 | lib/zhima/util.rb |