legion-json 1.3.1 → 1.3.2
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/CHANGELOG.md +6 -0
- data/CLAUDE.md +13 -7
- data/Gemfile +1 -0
- data/README.md +11 -2
- data/lib/legion/json/version.rb +1 -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: 84f736112017315b1ffb72f9ecced07fa994535232a413f1d620d2c73df1eace
|
|
4
|
+
data.tar.gz: 87a2927e1914bd50069fa67c01bc858df9ca1524ea0e3eb545218056f690e9d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97a1e4a75f2d3996dba14968b8bd96e06b62508d1d3f06c2a971bf442c36513156757336a50d2ae0c140079c81cc4a71266999777639c47079041df56aab38e3
|
|
7
|
+
data.tar.gz: 9ef6d473edc89d77a3aebb65b59e357ec1e8f1c94b4af31c9d4a1944b7566a3fd57df5a405c25a66c2faea58301ce2b327c9bb653a46274764db5d563a56cf17
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Legion::JSON
|
|
2
2
|
|
|
3
|
+
## [1.3.2] - 2026-04-08
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Removed `require 'legion/logging'` and `Legion::Logging::Helper` dependency that broke standalone usage (legion-logging is not a gemspec dependency)
|
|
7
|
+
- Fixed SimpleCov profile not being activated in spec_helper, restoring 100% coverage enforcement
|
|
8
|
+
|
|
3
9
|
## [1.3.1] - 2026-03-27
|
|
4
10
|
|
|
5
11
|
### Changed
|
data/CLAUDE.md
CHANGED
|
@@ -8,24 +8,30 @@
|
|
|
8
8
|
JSON wrapper module for the 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.
|
|
9
9
|
|
|
10
10
|
**GitHub**: https://github.com/LegionIO/legion-json
|
|
11
|
-
**Version**: 1.2
|
|
11
|
+
**Version**: 1.3.2
|
|
12
12
|
**License**: Apache-2.0
|
|
13
13
|
|
|
14
14
|
## Architecture
|
|
15
15
|
|
|
16
16
|
```
|
|
17
17
|
Legion::JSON
|
|
18
|
-
├── .load(string, symbolize_keys: true)
|
|
19
|
-
├── .dump(object, pretty: false)
|
|
20
|
-
├──
|
|
21
|
-
|
|
18
|
+
├── .load(string, symbolize_keys: true) # Deserialize JSON -> Hash (via MultiJson)
|
|
19
|
+
├── .dump(object = nil, pretty: false, **kwargs) # Serialize Hash -> JSON (via MultiJson); nil object uses kwargs
|
|
20
|
+
├── .parse(string, symbolize_names: true) # ::JSON.parse with symbolize_names (stdlib)
|
|
21
|
+
├── .generate(object) # ::JSON.generate (stdlib)
|
|
22
|
+
├── .pretty_generate(object) # ::JSON.pretty_generate (stdlib)
|
|
23
|
+
├── .fast_generate(object) # ::JSON.fast_generate (stdlib)
|
|
24
|
+
├── InvalidJson # Custom error class
|
|
25
|
+
└── ParseError # JSON parse error class
|
|
22
26
|
```
|
|
23
27
|
|
|
24
28
|
### Key Design Patterns
|
|
25
29
|
|
|
26
|
-
- **
|
|
27
|
-
- **Symbolized Keys by Default**: `symbolize_keys: true` is the default
|
|
30
|
+
- **Dual API**: `.load`/`.dump` route through MultiJson (adapter abstraction). `.parse`/`.generate`/`.pretty_generate`/`.fast_generate` route through Ruby stdlib `::JSON` directly.
|
|
31
|
+
- **Symbolized Keys by Default**: `symbolize_keys: true` is the default for `.load`; `symbolize_names: true` for `.parse`
|
|
28
32
|
- **Auto C-Extension**: If `oj` gem is installed, `multi_json` automatically uses it for performance
|
|
33
|
+
- **Keyword Form for dump**: `.dump(pretty: true, foo: 'bar')` — when `object` is nil, `**kwargs` become the data
|
|
34
|
+
- **Namespace note**: Inside `module Legion`, bare `JSON` resolves to `Legion::JSON`. Use `::JSON` to access stdlib.
|
|
29
35
|
|
|
30
36
|
## Dependencies
|
|
31
37
|
|
data/Gemfile
CHANGED
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.2
|
|
5
|
+
**Version**: 1.3.2
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -27,9 +27,18 @@ Legion::JSON.load(json_string, symbolize_keys: false) # => {"foo" => "bar", ..
|
|
|
27
27
|
|
|
28
28
|
hash = { foo: 'bar', nested: { hello: 'world' } }
|
|
29
29
|
Legion::JSON.dump(hash) # => '{"foo":"bar","nested":{"hello":"world"}}'
|
|
30
|
+
Legion::JSON.dump(pretty: true, foo: 'bar') # keyword form — object: nil uses kwargs as data
|
|
31
|
+
|
|
32
|
+
# Full stdlib surface
|
|
33
|
+
Legion::JSON.parse(json_string) # ::JSON.parse with symbolize_names: true
|
|
34
|
+
Legion::JSON.generate(object) # ::JSON.generate
|
|
35
|
+
Legion::JSON.pretty_generate(object) # ::JSON.pretty_generate
|
|
36
|
+
Legion::JSON.fast_generate(object) # ::JSON.fast_generate
|
|
30
37
|
```
|
|
31
38
|
|
|
32
|
-
Keys are symbolized by default, unlike standard Ruby JSON.
|
|
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`.
|
|
40
|
+
|
|
41
|
+
Inside `module Legion`, `JSON` resolves to `Legion::JSON`. Use `::JSON` to access stdlib directly.
|
|
33
42
|
|
|
34
43
|
## Requirements
|
|
35
44
|
|
data/lib/legion/json/version.rb
CHANGED