legion-json 1.2.1 → 1.3.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/.github/CODEOWNERS +7 -0
- data/.github/dependabot.yml +18 -0
- data/.github/workflows/ci.yml +20 -2
- data/CHANGELOG.md +15 -0
- data/lib/legion/json/helper.rb +14 -1
- data/lib/legion/json/version.rb +1 -1
- data/lib/legion/json.rb +25 -2
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9207e4ba4de5d46962daf28c5eba3f52062f0732093807f64d1fecaf08ac4e9
|
|
4
|
+
data.tar.gz: 66b65ae39fd1092625bf665a0a2324b502cda70a10f1d6b45841b962aaa049d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d7abc40ed9df6cb3a95a87549891d0bee745d2b32bb1a200c92124ac0ad866cdb0657e6ceaab9e10ab0c1f1dbc51a3775dd6fd382f0b9dccf183cc449e172c58
|
|
7
|
+
data.tar.gz: '0474844c608b995629c9f2ca594e0f149a53064a11a35f87d5fe8a7847eaf0c3caedf64e044917e9f9b0b8fbcdbba58a407dc0b0adb4763fdd37fc0a46ba481c'
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: bundler
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
day: monday
|
|
8
|
+
open-pull-requests-limit: 5
|
|
9
|
+
labels:
|
|
10
|
+
- "type:dependencies"
|
|
11
|
+
- package-ecosystem: github-actions
|
|
12
|
+
directory: /
|
|
13
|
+
schedule:
|
|
14
|
+
interval: weekly
|
|
15
|
+
day: monday
|
|
16
|
+
open-pull-requests-limit: 5
|
|
17
|
+
labels:
|
|
18
|
+
- "type:dependencies"
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -3,14 +3,32 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches: [main]
|
|
5
5
|
pull_request:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: '0 9 * * 1'
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
8
10
|
ci:
|
|
9
11
|
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
12
|
|
|
13
|
+
lint:
|
|
14
|
+
uses: LegionIO/.github/.github/workflows/lint-patterns.yml@main
|
|
15
|
+
|
|
16
|
+
security:
|
|
17
|
+
uses: LegionIO/.github/.github/workflows/security-scan.yml@main
|
|
18
|
+
|
|
19
|
+
version-changelog:
|
|
20
|
+
uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
|
|
21
|
+
|
|
22
|
+
dependency-review:
|
|
23
|
+
uses: LegionIO/.github/.github/workflows/dependency-review.yml@main
|
|
24
|
+
|
|
25
|
+
stale:
|
|
26
|
+
if: github.event_name == 'schedule'
|
|
27
|
+
uses: LegionIO/.github/.github/workflows/stale.yml@main
|
|
28
|
+
|
|
11
29
|
release:
|
|
12
|
-
needs: ci
|
|
30
|
+
needs: [ci, lint]
|
|
13
31
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
14
32
|
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
15
33
|
secrets:
|
|
16
|
-
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
|
34
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Legion::JSON
|
|
2
2
|
|
|
3
|
+
## [1.3.1] - 2026-03-27
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- `.dump` now accepts `**kwargs` — callers can pass `Legion::JSON.dump(key: val)` without wrapping in `{}`
|
|
7
|
+
- `pretty:` keyword option preserved; all other kwargs become the serialized object
|
|
8
|
+
|
|
9
|
+
## [1.3.0] - 2026-03-26
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `.parse(string, symbolize_names: true)` — wraps `::JSON.parse` with `ParseError` error handling and symbol keys by default
|
|
13
|
+
- `.generate(object)` — wraps `::JSON.generate` for compact output
|
|
14
|
+
- `.pretty_generate(object)` — wraps `::JSON.pretty_generate` for formatted output
|
|
15
|
+
- `.fast_generate(object)` — wraps `::JSON.fast_generate` for unchecked fast output
|
|
16
|
+
- Helper methods: `json_parse`, `json_generate`, `json_pretty_generate` in `Legion::JSON::Helper`
|
|
17
|
+
|
|
3
18
|
## [1.2.1] - 2026-03-22
|
|
4
19
|
|
|
5
20
|
### Added
|
data/lib/legion/json/helper.rb
CHANGED
|
@@ -8,7 +8,20 @@ module Legion
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def json_dump(object, pretty: false)
|
|
11
|
-
|
|
11
|
+
opts = { pretty: pretty }
|
|
12
|
+
Legion::JSON.dump(object, **opts)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def json_parse(string, symbolize_names: true)
|
|
16
|
+
Legion::JSON.parse(string, symbolize_names: symbolize_names)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def json_generate(object)
|
|
20
|
+
Legion::JSON.generate(object)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def json_pretty_generate(object)
|
|
24
|
+
Legion::JSON.pretty_generate(object)
|
|
12
25
|
end
|
|
13
26
|
end
|
|
14
27
|
end
|
data/lib/legion/json/version.rb
CHANGED
data/lib/legion/json.rb
CHANGED
|
@@ -21,9 +21,32 @@ module Legion
|
|
|
21
21
|
end
|
|
22
22
|
module_function :load
|
|
23
23
|
|
|
24
|
-
def dump(object, pretty: false)
|
|
25
|
-
|
|
24
|
+
def dump(object = nil, pretty: false, **kwargs)
|
|
25
|
+
data = object.nil? ? kwargs : object
|
|
26
|
+
parser.dump(data, pretty: pretty)
|
|
26
27
|
end
|
|
27
28
|
module_function :dump
|
|
29
|
+
|
|
30
|
+
def parse(string, symbolize_names: true)
|
|
31
|
+
::JSON.parse(string, symbolize_names: symbolize_names)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
raise Legion::JSON::ParseError.build(e, string)
|
|
34
|
+
end
|
|
35
|
+
module_function :parse
|
|
36
|
+
|
|
37
|
+
def generate(object)
|
|
38
|
+
::JSON.generate(object)
|
|
39
|
+
end
|
|
40
|
+
module_function :generate
|
|
41
|
+
|
|
42
|
+
def pretty_generate(object)
|
|
43
|
+
::JSON.pretty_generate(object)
|
|
44
|
+
end
|
|
45
|
+
module_function :pretty_generate
|
|
46
|
+
|
|
47
|
+
def fast_generate(object)
|
|
48
|
+
::JSON.fast_generate(object)
|
|
49
|
+
end
|
|
50
|
+
module_function :fast_generate
|
|
28
51
|
end
|
|
29
52
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: legion-json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -47,6 +47,8 @@ extra_rdoc_files:
|
|
|
47
47
|
- LICENSE
|
|
48
48
|
- README.md
|
|
49
49
|
files:
|
|
50
|
+
- ".github/CODEOWNERS"
|
|
51
|
+
- ".github/dependabot.yml"
|
|
50
52
|
- ".github/workflows/ci.yml"
|
|
51
53
|
- ".gitignore"
|
|
52
54
|
- ".rubocop.yml"
|