legion-json 1.3.2 → 1.3.4
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/.gitignore +1 -0
- data/CHANGELOG.md +10 -0
- data/README.md +2 -2
- data/lib/legion/json/version.rb +1 -1
- data/lib/legion/json.rb +4 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d5b1714516d77478efaf9e3fcbc1b1ee189f065650037a6f2edcdb816d5d280
|
|
4
|
+
data.tar.gz: b88137b2d325685ef2cd5f4fa97af6a2d8f61c7cc2246042fc690b8fa5012297
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c4061e8dccf00da6efc8bd8cd97c79599d537e2269c2e1ab8581b603c009c0758116a2f6619030c155a5374495a459ffc31611bea2c766b0f9b3b8292e93ecb
|
|
7
|
+
data.tar.gz: 69bb10a36ffd5386a8467fa6a5a0e8ce474060316a3c16e1fc3f098587ce067d1ded6d02849a1e17d034539efbf2bdd51c36b5992e5e9bd5781b105de3f088ef
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Legion::JSON
|
|
2
2
|
|
|
3
|
+
## [1.3.4] - 2026-11-09
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Preserve `Legion::JSON.fast_generate(object)` with JSON 3.x, which removed `JSON.fast_generate`: use `JSON.generate` when available and fall back to `JSON.fast_generate` otherwise.
|
|
7
|
+
|
|
8
|
+
## [1.3.3] - 2026-04-14
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `Legion::JSON.dump` with `pretty: false` (the default) produced pretty-printed output when Oj adapter was active. Oj/MultiJson treats any explicit `pretty:` keyword (even `false`) as truthy. Fix: only pass `pretty: true` when requested; omit the keyword entirely otherwise.
|
|
12
|
+
|
|
3
13
|
## [1.3.2] - 2026-04-08
|
|
4
14
|
|
|
5
15
|
### Fixed
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
JSON wrapper module for the [LegionIO](https://github.com/LegionIO/LegionIO) framework. Wraps `multi_json` and `json_pure` to provide a consistent JSON interface across all Legion gems and extensions. Automatically uses faster C-extension JSON gems (like `oj`) when available.
|
|
4
4
|
|
|
5
|
-
**Version**: 1.3.
|
|
5
|
+
**Version**: 1.3.4
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ Legion::JSON.dump(pretty: true, foo: 'bar') # keyword form — objec
|
|
|
33
33
|
Legion::JSON.parse(json_string) # ::JSON.parse with symbolize_names: true
|
|
34
34
|
Legion::JSON.generate(object) # ::JSON.generate
|
|
35
35
|
Legion::JSON.pretty_generate(object) # ::JSON.pretty_generate
|
|
36
|
-
Legion::JSON.fast_generate(object) # ::JSON.fast_generate
|
|
36
|
+
Legion::JSON.fast_generate(object) # ::JSON.generate when available; otherwise ::JSON.fast_generate
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Keys are symbolized by default, unlike standard Ruby JSON. `load` delegates to `MultiJson`; `parse`/`generate`/`pretty_generate`/`fast_generate` delegate to Ruby's stdlib `::JSON`.
|
data/lib/legion/json/version.rb
CHANGED
data/lib/legion/json.rb
CHANGED
|
@@ -23,7 +23,8 @@ module Legion
|
|
|
23
23
|
|
|
24
24
|
def dump(object = nil, pretty: false, **kwargs)
|
|
25
25
|
data = object.nil? ? kwargs : object
|
|
26
|
-
|
|
26
|
+
# Only pass pretty: when true — Oj/MultiJson treats any explicit pretty: (even false) as truthy
|
|
27
|
+
pretty ? parser.dump(data, pretty: true) : parser.dump(data)
|
|
27
28
|
end
|
|
28
29
|
module_function :dump
|
|
29
30
|
|
|
@@ -45,6 +46,8 @@ module Legion
|
|
|
45
46
|
module_function :pretty_generate
|
|
46
47
|
|
|
47
48
|
def fast_generate(object)
|
|
49
|
+
return ::JSON.generate(object) if ::JSON.respond_to?(:generate)
|
|
50
|
+
|
|
48
51
|
::JSON.fast_generate(object)
|
|
49
52
|
end
|
|
50
53
|
module_function :fast_generate
|