lib/lanmao/utils.rb in lanmao-0.13.0 vs lib/lanmao/utils.rb in lanmao-0.14.0
- old
+ new
@@ -8,14 +8,10 @@
# 把 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
+ hash.with_indifferent_access
end
def self.get_uuid(time=Time.now.to_i)
machine_id = Digest::MD5.digest(::Mac.addr).unpack("N")[0]
process_id = Process.pid % 0xFFFF