hashlib 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/hashlib.rb +16 -0
  2. metadata +2 -2
data/lib/hashlib.rb CHANGED
@@ -161,6 +161,22 @@ class Hash
161
161
 
162
162
  self
163
163
  end
164
+
165
+ def stringify_keys()
166
+ rv = {}
167
+ each do |k, v|
168
+ rv[k.to_s] = (v.is_a?(Hash) ? v.stringify_keys() : v)
169
+ end
170
+ return rv
171
+ end
172
+
173
+ def symbolize_keys()
174
+ rv = {}
175
+ each do |k, v|
176
+ rv[(k.to_sym rescue k)] = (v.is_a?(Hash) ? v.symbolize_keys() : v)
177
+ end
178
+ return rv
179
+ end
164
180
  end
165
181
 
166
182
  class Array
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.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  version: '0'
41
41
  requirements: []
42
42
  rubyforge_project:
43
- rubygems_version: 1.8.23
43
+ rubygems_version: 1.8.11
44
44
  signing_key:
45
45
  specification_version: 3
46
46
  summary: Useful utility methods for working with Ruby hashes