Sha256: 17bae72de5d4bdd18b7219cc38721c7308fb6ed26a59923f19ac34c7c6983c09
Contents?: true
Size: 406 Bytes
Versions: 6
Compression:
Stored size: 406 Bytes
Contents
# coding: utf-8 # 通用工具类方法 module ChanPay module Utils # 把 hash 中的 key,都转化为 symbol 类型 # # @param hash [Hash] 需要更改的 hash # @return [Hash] 更改后的 hash def self.symbolize_keys(hash) new_hash = {} hash.each do |key, value| new_hash[(key.to_sym rescue key) || key] = value end new_hash end end end
Version data entries
6 entries across 6 versions & 1 rubygems