abroad 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34e93e6b5d399235933e2d37d6edc811fe549529
4
- data.tar.gz: 40db0620847aa078d23800d3b7c9d60771c7b80e
3
+ metadata.gz: d58488676f4eb8a1b0e7175fc83f0c289f4778c5
4
+ data.tar.gz: 1b9cf5dcdccb829be755c20efd2f53b53fed815e
5
5
  SHA512:
6
- metadata.gz: 655543f3543cbc1a77452ae931b5eae8d012a888ff0e79ad8bc7a30e0de2f7c8c6d493c071020334ee83b5085ddd075d6e2ca3b912cfa747006d749dd71b0201
7
- data.tar.gz: e019dbca85b1f56303b183f1ca311d277441a5d6dcf273415d36f922f2cb2d8b00bae216d8a5eb6c606341807f0dcb93b1838f99d0091e797391dc94eccbc416
6
+ metadata.gz: 54e2d38f5ae6aa2d6b123d5e7c1f3e4e53eed0e15d2db9673ade6b3744438dc7d12c9948e13c23534995f0eaba4ff793ad72ca116828c4c0df9785ab00104606
7
+ data.tar.gz: ab71703d602f2ea4257f270ccfa5f44501d62e7c6a23001e89fa6ca6c048b3712cf2a799e55361a38f5cb99d29d938f73c552918dd31fc285692ab6f4efc3589
@@ -66,6 +66,17 @@ module Abroad
66
66
 
67
67
  def write_value(node, parent_key)
68
68
  value = (node ? node.value : '') || ''
69
+
70
+ # coerce numeric values
71
+ value = case value
72
+ when /\A\d+\z/
73
+ value.to_i
74
+ when /\A[\d.]+\z/
75
+ value.to_f
76
+ else
77
+ value
78
+ end
79
+
69
80
  if writer.in_map?
70
81
  writer.write_key_value(parent_key, value)
71
82
  else
@@ -1,3 +1,3 @@
1
1
  module Abroad
2
- VERSION = '4.0.1'
2
+ VERSION = '4.0.2'
3
3
  end
@@ -187,6 +187,20 @@ describe Yaml::RailsSerializer do
187
187
  })
188
188
  end
189
189
 
190
+ it 'writes ints and floats correctly' do
191
+ result = serialize do
192
+ serializer.write_key_value('foo', '3')
193
+ serializer.write_key_value('bar', '3.14')
194
+ end
195
+
196
+ expect(result).to eq({
197
+ 'fr' => {
198
+ 'foo' => 3,
199
+ 'bar' => 3.14
200
+ }
201
+ })
202
+ end
203
+
190
204
  it 'converts nils to empty strings' do
191
205
  result = serialize do
192
206
  serializer.write_key_value('foo.bar', nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abroad
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-30 00:00:00.000000000 Z
11
+ date: 2016-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities