hashlib 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/hashlib.rb +15 -2
  2. metadata +1 -1
data/lib/hashlib.rb CHANGED
@@ -165,15 +165,28 @@ class Hash
165
165
  def stringify_keys()
166
166
  rv = {}
167
167
  each do |k, v|
168
- rv[k.to_s] = (v.is_a?(Hash) ? v.stringify_keys() : v)
168
+ if v.is_a?(Hash)
169
+ v = v.stringify_keys()
170
+ elsif v.is_a?(Array)
171
+ v = v.map(&:stringify_keys)
172
+ end
173
+
174
+ rv[k.to_s] = v
169
175
  end
176
+
170
177
  return rv
171
178
  end
172
179
 
173
180
  def symbolize_keys()
174
181
  rv = {}
175
182
  each do |k, v|
176
- rv[(k.to_sym rescue k)] = (v.is_a?(Hash) ? v.symbolize_keys() : v)
183
+ if v.is_a?(Hash)
184
+ v = v.stringify_keys()
185
+ elsif v.is_a?(Array)
186
+ v = v.map(&:stringify_keys)
187
+ end
188
+
189
+ rv[(k.to_sym rescue k)] = v
177
190
  end
178
191
  return rv
179
192
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: