crack 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -0
- data/Gemfile +0 -1
- data/README.md +2 -0
- data/lib/crack/json.rb +6 -2
- data/lib/crack/version.rb +1 -1
- data/test/data/large_dataset.json +139988 -0
- data/test/json_test.rb +11 -0
- metadata +11 -8
data/test/json_test.rb
CHANGED
@@ -14,6 +14,8 @@ describe "JSON Parsing" do
|
|
14
14
|
%({"a": "'", "b": "5,000"}) => {"a" => "'", "b" => "5,000"},
|
15
15
|
%({"a": "a's, b's and c's", "b": "5,000"}) => {"a" => "a's, b's and c's", "b" => "5,000"},
|
16
16
|
%({"a": "2007-01-01"}) => {'a' => Date.new(2007, 1, 1)},
|
17
|
+
%({"first_date": "2016-01-25", "second_date": "2014-01-26"}) => {'first_date' => Date.new(2016, 1, 25), 'second_date' => Date.new(2014, 1, 26)},
|
18
|
+
%({"first_date": "2016-01-25", "non_date": "Abc", "second_date": "2014-01-26"}) => {'first_date' => Date.new(2016, 1, 25), 'non_date' => 'Abc', 'second_date' => Date.new(2014, 1, 26)},
|
17
19
|
%({"a": "2007-01-01 01:12:34 Z"}) => {'a' => Time.utc(2007, 1, 1, 1, 12, 34)},
|
18
20
|
# Handle ISO 8601 date/time format http://en.wikipedia.org/wiki/ISO_8601
|
19
21
|
%({"a": "2007-01-01T01:12:34Z"}) => {'a' => Time.utc(2007, 1, 1, 1, 12, 34)},
|
@@ -77,4 +79,13 @@ describe "JSON Parsing" do
|
|
77
79
|
|
78
80
|
Crack::JSON.parse(data)
|
79
81
|
end
|
82
|
+
|
83
|
+
it "does not raise SystemStackError when parsing large JSON files" do
|
84
|
+
data = ''
|
85
|
+
File.open(File.dirname(__FILE__) + "/data/large_dataset.json", "r") { |f|
|
86
|
+
data = f.read
|
87
|
+
}
|
88
|
+
|
89
|
+
Crack::JSON.parse(data)
|
90
|
+
end
|
80
91
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.0
|
27
27
|
description: Really simple JSON and XML parsing, ripped from Merb and Rails.
|
@@ -31,7 +31,8 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
34
|
+
- ".gitignore"
|
35
|
+
- ".travis.yml"
|
35
36
|
- Gemfile
|
36
37
|
- History
|
37
38
|
- LICENSE
|
@@ -45,6 +46,7 @@ files:
|
|
45
46
|
- script/bootstrap
|
46
47
|
- script/release
|
47
48
|
- script/test
|
49
|
+
- test/data/large_dataset.json
|
48
50
|
- test/data/twittersearch-firefox.json
|
49
51
|
- test/data/twittersearch-ie.json
|
50
52
|
- test/hash_test.rb
|
@@ -63,21 +65,22 @@ require_paths:
|
|
63
65
|
- lib
|
64
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
67
|
requirements:
|
66
|
-
- -
|
68
|
+
- - ">="
|
67
69
|
- !ruby/object:Gem::Version
|
68
70
|
version: '0'
|
69
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
72
|
requirements:
|
71
|
-
- -
|
73
|
+
- - ">="
|
72
74
|
- !ruby/object:Gem::Version
|
73
75
|
version: '0'
|
74
76
|
requirements: []
|
75
77
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.2.2
|
77
79
|
signing_key:
|
78
80
|
specification_version: 4
|
79
81
|
summary: Really simple JSON and XML parsing, ripped from Merb and Rails.
|
80
82
|
test_files:
|
83
|
+
- test/data/large_dataset.json
|
81
84
|
- test/data/twittersearch-firefox.json
|
82
85
|
- test/data/twittersearch-ie.json
|
83
86
|
- test/hash_test.rb
|