legion-json 0.1.0 → 1.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 +5 -5
- data/.circleci/config.yml +63 -112
- data/.circleci/setup-rubygems.sh +2 -0
- data/.gitignore +4 -1
- data/{.rubocop → .rubocop.yml} +7 -5
- data/Gemfile +0 -1
- data/Gemfile.lock +76 -0
- data/README.md +0 -31
- data/bitbucket-pipelines.yml +10 -10
- data/codecov.yml +3 -0
- data/legion-json.gemspec +18 -14
- data/lib/legion/json.rb +9 -31
- data/lib/legion/json/version.rb +1 -1
- data/sonar-project.properties +11 -0
- metadata +62 -41
- data/lib/legion/json/jrjackson.rb +0 -16
- data/lib/legion/json/oj.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 075666ae837d9b387872a4723e3c28d41e33a2b790ebc5fb409dd9dee7e3d158
|
|
4
|
+
data.tar.gz: e1794428fa93b05562b51a5b29f27315fb26c120894414418575ad5e60bd86d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7d192bc73376b82f198d49293a5f634e0100ad24fe94a0241ff8bc73787ba450a27dafa2b871977bd04132c58e31bafa9cc2fa5eb547e59ee558bcf09be1e9b
|
|
7
|
+
data.tar.gz: 16039e051d56c19efb5962839f39e5b9c870dee3e30eda054980edef0fd73fba9f1b3b388db21c8384978bee3e8a03fb4b1d592db6ec748fa1e8bd8bf701a352
|
data/.circleci/config.yml
CHANGED
|
@@ -1,91 +1,56 @@
|
|
|
1
|
-
version: 2
|
|
1
|
+
version: 2.1
|
|
2
|
+
orbs:
|
|
3
|
+
ruby: circleci/ruby@0.2.1
|
|
4
|
+
sonarcloud: sonarsource/sonarcloud@1.0.1
|
|
5
|
+
|
|
2
6
|
jobs:
|
|
3
7
|
"rubocop":
|
|
4
8
|
docker:
|
|
5
|
-
- image: circleci/ruby:2.
|
|
9
|
+
- image: circleci/ruby:2.7-node
|
|
6
10
|
steps:
|
|
7
11
|
- checkout
|
|
8
|
-
-
|
|
12
|
+
- ruby/load-cache
|
|
13
|
+
- ruby/install-deps
|
|
9
14
|
- run:
|
|
10
15
|
name: Run Rubocop
|
|
11
|
-
command: rubocop
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
"ruby-2.0":
|
|
16
|
+
command: bundle exec rubocop
|
|
17
|
+
- ruby/save-cache
|
|
18
|
+
"ruby-two-five":
|
|
15
19
|
docker:
|
|
16
|
-
- image: circleci/ruby:2.
|
|
20
|
+
- image: circleci/ruby:2.5
|
|
17
21
|
steps:
|
|
18
22
|
- checkout
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
path: test-results
|
|
28
|
-
"ruby-2.1":
|
|
29
|
-
docker:
|
|
30
|
-
- image: circleci/ruby:2.1
|
|
31
|
-
steps:
|
|
32
|
-
- checkout
|
|
33
|
-
- run:
|
|
34
|
-
name: Bundle Install
|
|
35
|
-
command: bundle install
|
|
36
|
-
- run:
|
|
37
|
-
name: Run RSpec
|
|
38
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
|
39
|
-
when: always
|
|
40
|
-
- store_test_results:
|
|
41
|
-
path: test-results
|
|
42
|
-
"ruby-2.2":
|
|
43
|
-
docker:
|
|
44
|
-
- image: circleci/ruby:2.2
|
|
45
|
-
steps:
|
|
46
|
-
- checkout
|
|
47
|
-
- run:
|
|
48
|
-
name: Bundle Install
|
|
49
|
-
command: bundle install
|
|
50
|
-
- run:
|
|
51
|
-
name: Run RSpec
|
|
52
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
|
53
|
-
when: always
|
|
54
|
-
- store_test_results:
|
|
55
|
-
path: test-results
|
|
56
|
-
|
|
57
|
-
"ruby-2.3":
|
|
23
|
+
- ruby/load-cache
|
|
24
|
+
- run:
|
|
25
|
+
name: update bundler
|
|
26
|
+
command: gem update bundler
|
|
27
|
+
- ruby/install-deps
|
|
28
|
+
- ruby/run-tests
|
|
29
|
+
- ruby/save-cache
|
|
30
|
+
"ruby-two-six":
|
|
58
31
|
docker:
|
|
59
|
-
- image: circleci/ruby:2.
|
|
32
|
+
- image: circleci/ruby:2.6
|
|
60
33
|
steps:
|
|
61
34
|
- checkout
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
path: test-results
|
|
71
|
-
|
|
72
|
-
"ruby-2.4":
|
|
35
|
+
- ruby/load-cache
|
|
36
|
+
- run:
|
|
37
|
+
name: update bundler
|
|
38
|
+
command: gem update bundler
|
|
39
|
+
- ruby/install-deps
|
|
40
|
+
- ruby/run-tests
|
|
41
|
+
- ruby/save-cache
|
|
42
|
+
"ruby-two-seven":
|
|
73
43
|
docker:
|
|
74
|
-
- image: circleci/ruby:2.
|
|
44
|
+
- image: circleci/ruby:2.7
|
|
75
45
|
steps:
|
|
76
46
|
- checkout
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
|
83
|
-
when: always
|
|
84
|
-
- store_test_results:
|
|
85
|
-
path: test-results
|
|
86
|
-
"ruby-2.5":
|
|
47
|
+
- ruby/load-cache
|
|
48
|
+
- ruby/install-deps
|
|
49
|
+
- ruby/run-tests
|
|
50
|
+
- ruby/save-cache
|
|
51
|
+
"jruby-nine-two":
|
|
87
52
|
docker:
|
|
88
|
-
- image: circleci/
|
|
53
|
+
- image: circleci/jruby:9.2-jre
|
|
89
54
|
steps:
|
|
90
55
|
- checkout
|
|
91
56
|
- run:
|
|
@@ -97,9 +62,10 @@ jobs:
|
|
|
97
62
|
when: always
|
|
98
63
|
- store_test_results:
|
|
99
64
|
path: test-results
|
|
100
|
-
|
|
65
|
+
- sonarcloud/scan
|
|
66
|
+
"jruby-nine-two-e":
|
|
101
67
|
docker:
|
|
102
|
-
- image: circleci/
|
|
68
|
+
- image: circleci/jruby:9.2.11-jre
|
|
103
69
|
steps:
|
|
104
70
|
- checkout
|
|
105
71
|
- run:
|
|
@@ -111,57 +77,42 @@ jobs:
|
|
|
111
77
|
when: always
|
|
112
78
|
- store_test_results:
|
|
113
79
|
path: test-results
|
|
114
|
-
"
|
|
80
|
+
"sonarcloud":
|
|
115
81
|
docker:
|
|
116
|
-
- image: circleci/
|
|
82
|
+
- image: circleci/ruby:2.7
|
|
117
83
|
steps:
|
|
118
84
|
- checkout
|
|
85
|
+
- ruby/load-cache
|
|
86
|
+
- ruby/install-deps
|
|
87
|
+
- ruby/run-tests
|
|
119
88
|
- run:
|
|
120
|
-
name:
|
|
121
|
-
command: bundle
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
|
|
125
|
-
when: always
|
|
126
|
-
- store_test_results:
|
|
127
|
-
path: test-results
|
|
89
|
+
name: Run Rubocop
|
|
90
|
+
command: bundle exec rubocop --format=json --out=rubocop-result.json
|
|
91
|
+
- sonarcloud/scan
|
|
92
|
+
- ruby/save-cache
|
|
128
93
|
|
|
129
94
|
workflows:
|
|
130
95
|
version: 2
|
|
131
|
-
|
|
96
|
+
rubocop-rspec:
|
|
132
97
|
jobs:
|
|
133
98
|
- rubocop
|
|
134
|
-
- ruby-
|
|
99
|
+
- ruby-two-five:
|
|
135
100
|
requires:
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
branches:
|
|
139
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
140
|
-
- ruby-2.3:
|
|
101
|
+
- rubocop
|
|
102
|
+
- ruby-two-six:
|
|
141
103
|
requires:
|
|
142
|
-
- ruby-
|
|
143
|
-
|
|
144
|
-
branches:
|
|
145
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
146
|
-
- ruby-2.4:
|
|
104
|
+
- ruby-two-five
|
|
105
|
+
- ruby-two-seven:
|
|
147
106
|
requires:
|
|
148
|
-
-
|
|
149
|
-
-
|
|
107
|
+
- ruby-two-five
|
|
108
|
+
- sonarcloud:
|
|
150
109
|
requires:
|
|
151
|
-
- ruby-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
155
|
-
- ruby-2.6:
|
|
110
|
+
- ruby-two-seven
|
|
111
|
+
- ruby-two-six
|
|
112
|
+
- jruby-nine-two:
|
|
156
113
|
requires:
|
|
157
|
-
- ruby-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
only: /\bdevelop\b|\bmaster\b/
|
|
161
|
-
- jruby-9.2:
|
|
114
|
+
- ruby-two-seven
|
|
115
|
+
- ruby-two-six
|
|
116
|
+
- jruby-nine-two-e:
|
|
162
117
|
requires:
|
|
163
|
-
-
|
|
164
|
-
- ruby-2.3
|
|
165
|
-
- ruby-2.4
|
|
166
|
-
- ruby-2.5
|
|
167
|
-
- ruby-2.6
|
|
118
|
+
- jruby-nine-two
|
data/.gitignore
CHANGED
data/{.rubocop → .rubocop.yml}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require: rubocop-performance
|
|
2
|
+
Layout/LineLength:
|
|
2
3
|
Max: 120
|
|
3
4
|
Metrics/MethodLength:
|
|
4
5
|
Max: 30
|
|
@@ -8,17 +9,18 @@ Metrics/BlockLength:
|
|
|
8
9
|
Max: 50
|
|
9
10
|
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
11
|
EnforcedStyle: space
|
|
12
|
+
Style/OptionalBooleanParameter:
|
|
13
|
+
Enabled: false
|
|
11
14
|
Style/SymbolArray:
|
|
12
15
|
Enabled: true
|
|
13
|
-
Layout/
|
|
16
|
+
Layout/HashAlignment:
|
|
14
17
|
EnforcedHashRocketStyle: table
|
|
15
18
|
EnforcedColonStyle: table
|
|
16
|
-
Style/HashSyntax:
|
|
17
|
-
EnforcedStyle: ruby19_no_mixed_keys
|
|
18
19
|
Style/Documentation:
|
|
19
20
|
Enabled: false
|
|
20
21
|
AllCops:
|
|
21
|
-
TargetRubyVersion: 2.
|
|
22
|
+
TargetRubyVersion: 2.5
|
|
23
|
+
NewCops: enable
|
|
22
24
|
Style/FrozenStringLiteralComment:
|
|
23
25
|
Enabled: false
|
|
24
26
|
Naming/FileName:
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
legion-json (1.1.1)
|
|
5
|
+
multi_json
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
ast (2.4.1)
|
|
11
|
+
codecov (0.2.8)
|
|
12
|
+
json
|
|
13
|
+
simplecov
|
|
14
|
+
diff-lcs (1.4.4)
|
|
15
|
+
docile (1.3.2)
|
|
16
|
+
json (2.3.1)
|
|
17
|
+
multi_json (1.15.0)
|
|
18
|
+
parallel (1.19.2)
|
|
19
|
+
parser (2.7.1.4)
|
|
20
|
+
ast (~> 2.4.1)
|
|
21
|
+
rainbow (3.0.0)
|
|
22
|
+
rake (13.0.1)
|
|
23
|
+
regexp_parser (1.7.1)
|
|
24
|
+
rexml (3.2.4)
|
|
25
|
+
rspec (3.9.0)
|
|
26
|
+
rspec-core (~> 3.9.0)
|
|
27
|
+
rspec-expectations (~> 3.9.0)
|
|
28
|
+
rspec-mocks (~> 3.9.0)
|
|
29
|
+
rspec-core (3.9.2)
|
|
30
|
+
rspec-support (~> 3.9.3)
|
|
31
|
+
rspec-expectations (3.9.2)
|
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
33
|
+
rspec-support (~> 3.9.0)
|
|
34
|
+
rspec-mocks (3.9.1)
|
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
+
rspec-support (~> 3.9.0)
|
|
37
|
+
rspec-support (3.9.3)
|
|
38
|
+
rspec_junit_formatter (0.4.1)
|
|
39
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
40
|
+
rubocop (0.89.1)
|
|
41
|
+
parallel (~> 1.10)
|
|
42
|
+
parser (>= 2.7.1.1)
|
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
44
|
+
regexp_parser (>= 1.7)
|
|
45
|
+
rexml
|
|
46
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
|
47
|
+
ruby-progressbar (~> 1.7)
|
|
48
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
49
|
+
rubocop-ast (0.3.0)
|
|
50
|
+
parser (>= 2.7.1.4)
|
|
51
|
+
rubocop-performance (1.7.1)
|
|
52
|
+
rubocop (>= 0.82.0)
|
|
53
|
+
ruby-progressbar (1.10.1)
|
|
54
|
+
simplecov (0.17.1)
|
|
55
|
+
docile (~> 1.1)
|
|
56
|
+
json (>= 1.8, < 3)
|
|
57
|
+
simplecov-html (~> 0.10.0)
|
|
58
|
+
simplecov-html (0.10.2)
|
|
59
|
+
unicode-display_width (1.7.0)
|
|
60
|
+
|
|
61
|
+
PLATFORMS
|
|
62
|
+
ruby
|
|
63
|
+
|
|
64
|
+
DEPENDENCIES
|
|
65
|
+
bundler
|
|
66
|
+
codecov (~> 0)
|
|
67
|
+
legion-json!
|
|
68
|
+
rake
|
|
69
|
+
rspec
|
|
70
|
+
rspec_junit_formatter
|
|
71
|
+
rubocop
|
|
72
|
+
rubocop-performance
|
|
73
|
+
simplecov (< 0.18.0)
|
|
74
|
+
|
|
75
|
+
BUNDLED WITH
|
|
76
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -2,41 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Legion::Json is part of the Legion Framework
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
Add this line to your application's Gemfile:
|
|
9
|
-
|
|
10
|
-
```ruby
|
|
11
|
-
gem 'legion-json'
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
And then execute:
|
|
15
|
-
|
|
16
|
-
$ bundle
|
|
17
|
-
|
|
18
|
-
Or install it yourself as:
|
|
19
|
-
|
|
20
|
-
$ gem install legion-json
|
|
21
|
-
|
|
22
5
|
## Usage
|
|
23
6
|
|
|
24
7
|
This library provides the Legion JSON parser abstraction, enabling the use of platform specific JSON parsers.
|
|
25
8
|
|
|
26
|
-
## Development
|
|
27
|
-
|
|
28
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
29
|
-
|
|
30
|
-
To install this gem onto your local machine, run `bundle exec install`.
|
|
31
|
-
|
|
32
|
-
## Contributing
|
|
33
|
-
|
|
34
|
-
Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/legion-io/legion-json/issues This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
35
|
-
|
|
36
9
|
## License
|
|
37
10
|
|
|
38
11
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
39
|
-
|
|
40
|
-
## Credit
|
|
41
|
-
|
|
42
|
-
This gem was based on the Sensu JSON gem. You can find the original gem [here](https://github.com/sensu/sensu-json)
|
data/bitbucket-pipelines.yml
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
image: ruby:2.4.0
|
|
2
2
|
|
|
3
3
|
pipelines:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
tags:
|
|
5
|
+
'0.1.1':
|
|
6
|
+
- step:
|
|
7
|
+
name: Deploy to Rubygems MRI
|
|
8
|
+
image: ruby:2.5.0
|
|
9
|
+
deployment: production
|
|
10
|
+
script:
|
|
11
|
+
- bash .circleci/setup-rubygems.sh
|
|
12
|
+
- gem build legion-json.gemspec
|
|
13
|
+
- gem push "legion-json-$(git describe --tags).gem"
|
|
14
14
|
definitions:
|
|
15
15
|
caches:
|
|
16
16
|
bundler: vendor/bundle
|
data/codecov.yml
ADDED
data/legion-json.gemspec
CHANGED
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
3
3
|
require 'legion/json/version'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name
|
|
6
|
+
spec.name = 'legion-json'
|
|
7
7
|
spec.version = Legion::Json::VERSION
|
|
8
8
|
spec.authors = ['Esity']
|
|
9
9
|
spec.email = ['matthewdiverson@gmail.com']
|
|
@@ -12,25 +12,29 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = 'A gem used to load and use JSON objects inside the Legion framework'
|
|
13
13
|
spec.homepage = 'https://bitbucket.org/legion-io/legion-json'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '
|
|
15
|
+
spec.required_ruby_version = '>= 2.5'
|
|
16
|
+
spec.metadata = {
|
|
17
|
+
'bug_tracker_uri' => 'https://legionio.atlassian.net/projects/JSON/issues',
|
|
18
|
+
'changelog_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON',
|
|
19
|
+
'documentation_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON',
|
|
20
|
+
'homepage_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION',
|
|
21
|
+
'source_code_uri' => 'https://bitbucket.org/legion-io/legion-json',
|
|
22
|
+
'wiki_uri' => 'https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON'
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
26
|
f.match(%r{^(test|spec|features)/})
|
|
19
27
|
end
|
|
20
|
-
spec.bindir = 'exe'
|
|
21
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
29
|
spec.require_paths = ['lib']
|
|
23
30
|
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
|
31
|
+
spec.add_development_dependency 'bundler'
|
|
25
32
|
spec.add_development_dependency 'codecov', '~> 0'
|
|
26
|
-
spec.add_development_dependency 'rake'
|
|
27
|
-
spec.add_development_dependency 'rspec'
|
|
28
|
-
spec.add_development_dependency 'rspec_junit_formatter'
|
|
29
|
-
spec.add_development_dependency 'rubocop'
|
|
30
|
-
spec.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
else
|
|
34
|
-
spec.add_dependency('oj', '~> 2.18')
|
|
35
|
-
end
|
|
33
|
+
spec.add_development_dependency 'rake'
|
|
34
|
+
spec.add_development_dependency 'rspec'
|
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
|
36
|
+
spec.add_development_dependency 'rubocop'
|
|
37
|
+
spec.add_development_dependency 'rubocop-performance'
|
|
38
|
+
spec.add_development_dependency 'simplecov', '< 0.18.0'
|
|
39
|
+
spec.add_dependency 'multi_json'
|
|
36
40
|
end
|
data/lib/legion/json.rb
CHANGED
|
@@ -1,45 +1,23 @@
|
|
|
1
1
|
require 'legion/json/version'
|
|
2
2
|
require 'legion/json/parse_error'
|
|
3
|
+
require 'multi_json'
|
|
3
4
|
|
|
4
5
|
module Legion
|
|
5
|
-
# Used to create JSON objects
|
|
6
6
|
module JSON
|
|
7
7
|
class << self
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# the bottom of this file. The appropriate JSON parser will be
|
|
11
|
-
# loaded for the current platform.
|
|
12
|
-
#
|
|
13
|
-
# @return [Object] parser.
|
|
14
|
-
def setup!
|
|
15
|
-
if RUBY_ENGINE == 'jruby'
|
|
16
|
-
require 'legion/json/jrjackson'
|
|
17
|
-
@parser = Legion::JSON::JrJackson.new
|
|
18
|
-
else
|
|
19
|
-
require 'legion/json/oj'
|
|
20
|
-
@parser = Legion::JSON::Oj.new
|
|
21
|
-
end
|
|
8
|
+
def parser
|
|
9
|
+
@parser ||= MultiJson
|
|
22
10
|
end
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def load(string)
|
|
29
|
-
@parser.load(string)
|
|
30
|
-
rescue StandardError => error
|
|
31
|
-
raise Legion::JSON::ParseError.build(error, string)
|
|
12
|
+
def load(string, symbolize_keys = true)
|
|
13
|
+
parser.load(string, symbolize_keys: symbolize_keys)
|
|
14
|
+
rescue StandardError => e
|
|
15
|
+
raise Legion::JSON::ParseError.build(e, string)
|
|
32
16
|
end
|
|
33
17
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# @param object [Object]
|
|
37
|
-
# @param options [Hash]
|
|
38
|
-
def dump(object, options = {})
|
|
39
|
-
@parser.dump(object, options)
|
|
18
|
+
def dump(object, pretty = false)
|
|
19
|
+
parser.dump(object, pretty: pretty)
|
|
40
20
|
end
|
|
41
21
|
end
|
|
42
22
|
end
|
|
43
23
|
end
|
|
44
|
-
|
|
45
|
-
Legion::JSON.setup!
|
data/lib/legion/json/version.rb
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
sonar.projectKey=legion-io_legion-json
|
|
2
|
+
sonar.organization=legion-io
|
|
3
|
+
sonar.sources=.
|
|
4
|
+
sonar.exclusions=vendor/**
|
|
5
|
+
sonar.coverage.exclusions=spec/**
|
|
6
|
+
sonar.ruby.coverage.reportPath=coverage/.resultset.json
|
|
7
|
+
sonar.ruby.file.suffixes=rb,ruby
|
|
8
|
+
sonar.ruby.coverage.framework=RSpec
|
|
9
|
+
sonar.ruby.rubocopConfig=.rubocop.yml
|
|
10
|
+
sonar.ruby.rubocop.reportPath=rubocop-result.json
|
|
11
|
+
sonar.ruby.rubocop.filePath=.
|
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: legion-json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
autorequire:
|
|
9
|
-
bindir:
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: codecov
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -42,86 +42,100 @@ dependencies:
|
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rspec_junit_formatter
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- - "
|
|
80
|
+
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rubocop
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- - "
|
|
87
|
+
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
89
|
version: '0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- - "
|
|
94
|
+
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: rubocop-performance
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
104
|
-
type: :
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
110
|
+
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
112
|
+
name: simplecov
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - "<"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 0.18.0
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "<"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 0.18.0
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: multi_json
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
116
130
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
131
|
+
version: '0'
|
|
118
132
|
type: :runtime
|
|
119
133
|
prerelease: false
|
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
135
|
requirements:
|
|
122
|
-
- - "
|
|
136
|
+
- - ">="
|
|
123
137
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
138
|
+
version: '0'
|
|
125
139
|
description: A gem used to load and use JSON objects inside the Legion framework
|
|
126
140
|
email:
|
|
127
141
|
- matthewdiverson@gmail.com
|
|
@@ -130,43 +144,50 @@ extensions: []
|
|
|
130
144
|
extra_rdoc_files: []
|
|
131
145
|
files:
|
|
132
146
|
- ".circleci/config.yml"
|
|
147
|
+
- ".circleci/setup-rubygems.sh"
|
|
133
148
|
- ".gitignore"
|
|
134
|
-
- ".rubocop"
|
|
149
|
+
- ".rubocop.yml"
|
|
135
150
|
- Gemfile
|
|
151
|
+
- Gemfile.lock
|
|
136
152
|
- LICENSE.txt
|
|
137
153
|
- README.md
|
|
138
154
|
- Rakefile
|
|
139
155
|
- bin/console
|
|
140
156
|
- bin/setup
|
|
141
157
|
- bitbucket-pipelines.yml
|
|
158
|
+
- codecov.yml
|
|
142
159
|
- legion-json.gemspec
|
|
143
160
|
- lib/legion/json.rb
|
|
144
|
-
- lib/legion/json/jrjackson.rb
|
|
145
|
-
- lib/legion/json/oj.rb
|
|
146
161
|
- lib/legion/json/parse_error.rb
|
|
147
162
|
- lib/legion/json/version.rb
|
|
163
|
+
- sonar-project.properties
|
|
148
164
|
homepage: https://bitbucket.org/legion-io/legion-json
|
|
149
165
|
licenses:
|
|
150
166
|
- MIT
|
|
151
|
-
metadata:
|
|
152
|
-
|
|
167
|
+
metadata:
|
|
168
|
+
bug_tracker_uri: https://legionio.atlassian.net/projects/JSON/issues
|
|
169
|
+
changelog_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
|
170
|
+
documentation_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
|
171
|
+
homepage_uri: https://legionio.atlassian.net/wiki/spaces/LEGION
|
|
172
|
+
source_code_uri: https://bitbucket.org/legion-io/legion-json
|
|
173
|
+
wiki_uri: https://legionio.atlassian.net/wiki/spaces/LEGION/pages/24674324/JSON
|
|
174
|
+
post_install_message:
|
|
153
175
|
rdoc_options: []
|
|
154
176
|
require_paths:
|
|
155
177
|
- lib
|
|
156
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
179
|
requirements:
|
|
158
|
-
- - "
|
|
180
|
+
- - ">="
|
|
159
181
|
- !ruby/object:Gem::Version
|
|
160
|
-
version: '2.
|
|
182
|
+
version: '2.5'
|
|
161
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
184
|
requirements:
|
|
163
185
|
- - ">="
|
|
164
186
|
- !ruby/object:Gem::Version
|
|
165
187
|
version: '0'
|
|
166
188
|
requirements: []
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
signing_key:
|
|
189
|
+
rubygems_version: 3.1.2
|
|
190
|
+
signing_key:
|
|
170
191
|
specification_version: 4
|
|
171
192
|
summary: Legion JSON
|
|
172
193
|
test_files: []
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
require 'jrjackson'
|
|
2
|
-
|
|
3
|
-
module Legion
|
|
4
|
-
module JSON
|
|
5
|
-
# The Legion JSON parser when running on JRuby.
|
|
6
|
-
class JrJackson
|
|
7
|
-
def load(string)
|
|
8
|
-
::JrJackson::Json.load(string, symbolize_keys: true, raw: true)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def dump(object, options = {})
|
|
12
|
-
::JrJackson::Json.dump(object, options)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
data/lib/legion/json/oj.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require 'oj'
|
|
2
|
-
Oj.default_options = { mode: :compat }
|
|
3
|
-
|
|
4
|
-
module Legion
|
|
5
|
-
module JSON
|
|
6
|
-
# The Legion JSON parser when running on MRI.
|
|
7
|
-
class Oj
|
|
8
|
-
def load(string)
|
|
9
|
-
::Oj.load(string, symbol_keys: true)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def dump(object, options = {})
|
|
13
|
-
options[:indent] = 2 if options[:pretty]
|
|
14
|
-
::Oj.dump(object, options)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|