rbdantic 0.1.0 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37afa4a091552f16fc1f64e2d62d379bd951b3dad5629a89b0592830ca295040
4
- data.tar.gz: 76a92811bedd13a1ebb80e07e0f64ea49304dab9e05254830b28aeb70259d120
3
+ metadata.gz: 1f31756908c3f101b3467b76d592b01e79e6270ca65e6af2c7aafbfd0ec29362
4
+ data.tar.gz: 4cc1e248332c2cfd58ff2e83d968d00c0bb1d73fd938fb927782eb898bb542b6
5
5
  SHA512:
6
- metadata.gz: 135f2987d799a19605d12ea4cdde9965bc5e8b26b73fb5ecd10c41b4bfd77505a3db12d5bc81a69cb4b842a675d20f8ce3511a390866cb95f4d4fc7eee144266
7
- data.tar.gz: b7006c98da7cd021f722d38b16461a36bbf168bfbeb9ff8612d88130f733802d6054ba32b03a5d92d2228b0e93983a8de32234750e49a19be62d3b8c656c946e
6
+ metadata.gz: 9e506a1022c3b43ac0ee4de6521e361648e32d10087ea99acdd292514fe5f0baced64ac88c10e3dccef6c1a6371f91cdefd9309ec299287fd3218b951904da5e
7
+ data.tar.gz: 80614dccf3af5d2c19d90d373782bfcae399f228a9c5d036e4bfeaeab28776a418f67fe46c505ee9d189261deaea702407fa8042755e4be83c20b93061d527f4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2026-04-06
4
+
5
+ - Add `to_h` alias method for `model_dump`
6
+
3
7
  ## [0.1.0] - 2026-04-04
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -60,6 +60,10 @@ puts user.tags # => []
60
60
  puts user.model_dump
61
61
  # => { name: "Alice", email: "alice@example.com", age: 30, tags: [] }
62
62
 
63
+ # to_h is an alias for model_dump
64
+ puts user.to_h
65
+ # => { name: "Alice", email: "alice@example.com", age: 30, tags: [] }
66
+
63
67
  # Serialize to JSON
64
68
  puts user.model_dump_json
65
69
  # => {"name":"Alice","email":"alice@example.com","age":30,"tags":[]}
@@ -797,6 +801,7 @@ rescue Rbdantic::ValidationError => e
797
801
  |--------|-------------|
798
802
  | `initialize(data = {})` | Create model with validation |
799
803
  | `model_dump(**options)` | Convert to Hash |
804
+ | `to_h` | Alias for `model_dump` |
800
805
  | `model_dump_json(indent: nil)` | Convert to JSON string |
801
806
  | `[name]` | Bracket access for field value |
802
807
  | `[name] = value` | Bracket assignment for field value |
data/README_CN.md CHANGED
@@ -60,6 +60,10 @@ puts user.tags # => []
60
60
  puts user.model_dump
61
61
  # => { name: "Alice", email: "alice@example.com", age: 30, tags: [] }
62
62
 
63
+ # to_h 是 model_dump 的别名
64
+ puts user.to_h
65
+ # => { name: "Alice", email: "alice@example.com", age: 30, tags: [] }
66
+
63
67
  # 序列化为 JSON
64
68
  puts user.model_dump_json
65
69
  # => {"name":"Alice","email":"alice@example.com","age":30,"tags":[]}
@@ -797,6 +801,7 @@ rescue Rbdantic::ValidationError => e
797
801
  |------|------|
798
802
  | `initialize(data = {})` | 创建并验证模型 |
799
803
  | `model_dump(**options)` | 转换为 Hash |
804
+ | `to_h` | `model_dump` 的别名 |
800
805
  | `model_dump_json(indent: nil)` | 转换为 JSON 字符串 |
801
806
  | `[name]` | 括号访问字段值 |
802
807
  | `[name] = value` | 括号赋值字段值 |
@@ -10,6 +10,8 @@ module Rbdantic
10
10
  Serialization::Dumper.dump(self, **options)
11
11
  end
12
12
 
13
+ alias to_h model_dump
14
+
13
15
  def model_dump_json(indent: nil, **options)
14
16
  Serialization::JsonSerializer.dump(self, indent: indent, **options)
15
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rbdantic
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbdantic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - cp5670681