strong_json 0.1.0 → 0.1.1
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 +4 -4
- data/lib/strong_json/type.rb +1 -1
- data/lib/strong_json/version.rb +1 -1
- data/spec/basetype_spec.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8c22cee2e96c616585aab8e4c116daa4e64944a
|
4
|
+
data.tar.gz: 0b52394883010d69ffa7cfc65107f2b7bd381987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 553c80f3d3c1941cf154b852662cbc462b523e77e11a2d49c12d98847ec412bf17a200c3756bb31f165c3e1c84759a278e4e65de90bff9f0db1998c693796561
|
7
|
+
data.tar.gz: 55fcd6bbb18191de401fc6aa9d29b23d0c0a07a5d217aebe3db7b477959602d22ae7670f744ae75c686b1ac3eaf25168c957caefc58ad08fcd4ea2f0ce4182da
|
data/lib/strong_json/type.rb
CHANGED
@@ -22,7 +22,7 @@ class StrongJSON
|
|
22
22
|
when :boolean
|
23
23
|
value == true || value == false
|
24
24
|
when :numeric
|
25
|
-
value.is_a?(Numeric) || value.is_a?(String) && /\A[\d.]+\Z/ =~ value
|
25
|
+
value.is_a?(Numeric) || value.is_a?(String) && /\A[\-\+]?[\d.]+\Z/ =~ value
|
26
26
|
else
|
27
27
|
false
|
28
28
|
end
|
data/lib/strong_json/version.rb
CHANGED
data/spec/basetype_spec.rb
CHANGED
@@ -73,6 +73,18 @@ describe StrongJSON::Type::Base do
|
|
73
73
|
expect(type.test("123")).to be_truthy
|
74
74
|
end
|
75
75
|
|
76
|
+
it "accepts negative number" do
|
77
|
+
expect(type.test("-123")).to be_truthy
|
78
|
+
end
|
79
|
+
|
80
|
+
it "accepts number with plus sign" do
|
81
|
+
expect(type.test("+123")).to be_truthy
|
82
|
+
end
|
83
|
+
|
84
|
+
it "accepts decimal number" do
|
85
|
+
expect(type.test("0.3")).to be_truthy
|
86
|
+
end
|
87
|
+
|
76
88
|
it "rejects non numeric format string" do
|
77
89
|
expect(type.test("test")).to be_falsey
|
78
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.4.5
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Type check JSON objects
|