numeric_hash 0.1.2 → 0.2.0
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.
- data/lib/numeric_hash.rb +9 -0
- data/lib/numeric_hash/version.rb +1 -1
- metadata +4 -4
data/lib/numeric_hash.rb
CHANGED
@@ -172,6 +172,15 @@ class NumericHash < Hash
|
|
172
172
|
[:to_f, :to_i, :to_int].each do |convert_method|
|
173
173
|
define_method("map_#{convert_method}".to_sym) { map_values(&convert_method) }
|
174
174
|
end
|
175
|
+
|
176
|
+
# Converts the NumericHash into a regular Hash.
|
177
|
+
#
|
178
|
+
def to_hash
|
179
|
+
inject({}) do |hash, (key, value)|
|
180
|
+
hash[key] = value.is_a?(NumericHash) ? value.to_hash : value
|
181
|
+
hash
|
182
|
+
end
|
183
|
+
end
|
175
184
|
|
176
185
|
protected
|
177
186
|
|
data/lib/numeric_hash/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numeric_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Clyde Law
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-02-21 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|