flex_columns 1.0.5 → 1.0.6
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.
- checksums.yaml +5 -5
- data/CHANGES.md +4 -0
- data/lib/flex_columns/contents/column_data.rb +2 -2
- data/lib/flex_columns/version.rb +1 -1
- data/spec/flex_columns/system/basic_system_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 77ffdb1f8ef333becb22e7ee81a54d32be00e4ce
|
4
|
-
data.tar.gz: 33e7afb514f21decc7fb4711f28c908a0e7e247b
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a346cd4387b83db2754cd6d18db49a616015ca230a0b18134f0a7176b4f206778a7f778cec4b97e84c59dfb0358339a2106b1e8656be922a54b2d0143867b1da
|
4
|
+
data.tar.gz: bebc4830bc2ea67bfa2152cca4587d751dd13da67c4afe22ea288e4522079510aaf2aa42b32fbff72a6b2af4c930ada099fafadb063cb384bb84f30c1a3c05c4
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: e57b169cbe90447775b3f4b0bf2c6e843825bb12
|
7
|
+
data.tar.gz: 314c670ba146241547f561a3354cf8473509f1be
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# `flex_columns` Changelog
|
2
2
|
|
3
|
+
## 1.0.6, 2014-04-07
|
4
|
+
|
5
|
+
* Fixed an issue where Float::INFINITY and Float::NaN could not be stored in a flex column.
|
6
|
+
|
3
7
|
## 1.0.5, 2014-04-03
|
4
8
|
|
5
9
|
* Fixed an issue where boolean fields would fail to validate if `:null => false` was passed and their value was `false`.
|
@@ -186,7 +186,7 @@ module FlexColumns
|
|
186
186
|
deserialize_if_necessary!
|
187
187
|
|
188
188
|
json_hash = to_json_hash
|
189
|
-
as_string = json_hash
|
189
|
+
as_string = JSON.generate(json_hash, :allow_nan => true)
|
190
190
|
as_string = as_string.encode(Encoding::UTF_8) if as_string.respond_to?(:encode)
|
191
191
|
|
192
192
|
as_string
|
@@ -351,7 +351,7 @@ module FlexColumns
|
|
351
351
|
# Parses JSON. This just adds exception handling that tells you exactly where the failure was.
|
352
352
|
def parse_json(json)
|
353
353
|
out = begin
|
354
|
-
JSON.parse(json)
|
354
|
+
JSON.parse(json, :allow_nan => true)
|
355
355
|
rescue ::JSON::ParserError => pe
|
356
356
|
raise FlexColumns::Errors::UnparseableJsonInDatabaseError.new(data_source, json, pe)
|
357
357
|
end
|
data/lib/flex_columns/version.rb
CHANGED
@@ -335,5 +335,21 @@ describe "FlexColumns basic operations" do
|
|
335
335
|
parsed = JSON.parse(user_bd.user_attributes)
|
336
336
|
parsed.keys.sort.should == %w{bbb}.sort
|
337
337
|
end
|
338
|
+
|
339
|
+
it "should allow serializing Float::INFINITY and Float::NaN" do
|
340
|
+
infinity = if defined?(Float::INFINITY) then Float::INFINITY else (1.0 / 0.0) end
|
341
|
+
nan = if defined?(Float::NaN) then Float::NaN else (0.0 / 0.0) end
|
342
|
+
|
343
|
+
user = ::User.new
|
344
|
+
user.name = 'User 1'
|
345
|
+
user.wants_email = { 'foo' => 'bar', 'bar' => infinity, 'baz' => nan, 'quux' => -infinity }
|
346
|
+
user.save!
|
347
|
+
|
348
|
+
user_again = ::User.find(user.id)
|
349
|
+
user_again.wants_email['foo'].should == 'bar'
|
350
|
+
user_again.wants_email['bar'].should == infinity
|
351
|
+
user_again.wants_email['baz'].should be_nan
|
352
|
+
user_again.wants_email['quux'].should == -infinity
|
353
|
+
end
|
338
354
|
end
|
339
355
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flex_columns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Geweke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-07 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|