lib/rock_fintech/sign/sign.rb in rock_fintech-0.9.0 vs lib/rock_fintech/sign/sign.rb in rock_fintech-0.10.0
- old
+ new
@@ -12,10 +12,11 @@
self.sign(data, config) == sign_str
end # verify
private
- def self.serialize(data)
+ def self.serialize(data_in)
+ data = Marshal.load( Marshal.dump(data_in) ) # deep clone, not affect original data
data = Hash[data.sort] # key 按照 alphabet 排序
data.each{ |k, v|
if v.kind_of?(Hash) # 如果是 hash 接着 serialize
data[k] = serialize(v)