numeric_hash 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
 
@@ -1,3 +1,3 @@
1
1
  class NumericHash < Hash
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
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: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
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-01-30 00:00:00 -08:00
18
+ date: 2012-02-21 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency