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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9207e4ba4de5d46962daf28c5eba3f52062f0732093807f64d1fecaf08ac4e9
4
- data.tar.gz: 66b65ae39fd1092625bf665a0a2324b502cda70a10f1d6b45841b962aaa049d1
3
+ metadata.gz: 84f736112017315b1ffb72f9ecced07fa994535232a413f1d620d2c73df1eace
4
+ data.tar.gz: 87a2927e1914bd50069fa67c01bc858df9ca1524ea0e3eb545218056f690e9d0
5
5
  SHA512:
6
- metadata.gz: d7abc40ed9df6cb3a95a87549891d0bee745d2b32bb1a200c92124ac0ad866cdb0657e6ceaab9e10ab0c1f1dbc51a3775dd6fd382f0b9dccf183cc449e172c58
7
- data.tar.gz: '0474844c608b995629c9f2ca594e0f149a53064a11a35f87d5fe8a7847eaf0c3caedf64e044917e9f9b0b8fbcdbba58a407dc0b0adb4763fdd37fc0a46ba481c'
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.0
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) # Deserialize JSON -> Hash
19
- ├── .dump(object, pretty: false) # Serialize Hash -> JSON
20
- ├── InvalidJson # Custom error class
21
- └── ParseError # JSON parse error class
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
- - **Thin Wrapper**: Delegates to `MultiJson.load` / `MultiJson.dump`
27
- - **Symbolized Keys by Default**: `symbolize_keys: true` is the default (unlike standard JSON)
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
@@ -8,5 +8,6 @@ group :test do
8
8
  gem 'rspec'
9
9
  gem 'rspec_junit_formatter'
10
10
  gem 'rubocop'
11
+ gem 'rubocop-legion'
11
12
  gem 'simplecov'
12
13
  end
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.0
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Json
5
- VERSION = '1.3.1'
5
+ VERSION = '1.3.2'
6
6
  end
7
7
  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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity