philiprehberger-toml_kit 0.3.0 → 0.4.0

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: 174ea153b4049cb9bfa03861fcfd17b0a1d6ca732c77bee833596261d8c3ac73
4
- data.tar.gz: 9bcc85d52e0186652cee5b9304c4673da3f66d0eec8a4ff70ecd2bdfc856635b
3
+ metadata.gz: 8cdca57335aa874bbc1ed3f637df91a738bddc6316b82df101925c0ed383fc37
4
+ data.tar.gz: 6edfe631dd620f5def0c1477db9a14a2bed6eba13810a9ce03d3548abba062eb
5
5
  SHA512:
6
- metadata.gz: e45be50d82be1e07d068a2932aa9c5889f5f2ae3a9fde62ec76850d9df3e9b3297ce3fa2fd46999af8f8fbc2e47e49ca1f5c89f3f5c0d8bd00e11fb7ea05d687
7
- data.tar.gz: d65fe1af77f1fb87a56a4270e5bc2a7624fec1f75cab35bf56a24bc6f69369c9b5464991870475abe166b785626d64e23788141dfc68d8e3f6ea4a9baf6e0ccb
6
+ metadata.gz: 56b547d9009966fc988cc954fca8a3a40b35057306b936db0a487f275a3b97bae6e959f08134c08f40198896a335bfde902484e9c026e09c7a5116cf39d5a8a4
7
+ data.tar.gz: 745fdff008a2c06306ccc64567119401b12578369783fe6afcf39003ef0d4604a89ff3dc2279d765eb82e68a720cdf3d888ca502379bcab94cd8682508a5f5f6
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.0] - 2026-04-30
11
+
12
+ ### Added
13
+ - `TomlKit.set(data, path, value)` — set a nested value at a dot-path, creating intermediate hashes as needed (mirrors `TomlKit.query`)
14
+ - `TomlKit.delete(data, path)` — delete a nested key by dot-path; returns the removed value or `nil`
15
+ - `TomlKit.exists?(data, path)` — check whether a dot-path resolves to a value
16
+
10
17
  ## [0.3.0] - 2026-04-15
11
18
 
12
19
  ### Added
data/README.md CHANGED
@@ -203,10 +203,10 @@ Philiprehberger::TomlKit.query(data, "servers[0].name")
203
203
  Philiprehberger::TomlKit.query(data, "missing.path", default: "N/A")
204
204
  # => "N/A"
205
205
 
206
- # Additional Query methods
207
- Philiprehberger::TomlKit::Query.set(data, "database.timeout", 30)
208
- Philiprehberger::TomlKit::Query.exists?(data, "database.host") # => true
209
- Philiprehberger::TomlKit::Query.delete(data, "database.timeout") # => 30
206
+ # Top-level mutators (mirror TomlKit.query)
207
+ Philiprehberger::TomlKit.set(data, "database.timeout", 30)
208
+ Philiprehberger::TomlKit.exists?(data, "database.host") # => true
209
+ Philiprehberger::TomlKit.delete(data, "database.timeout") # => 30
210
210
  ```
211
211
 
212
212
  ### Type Coercion Hooks
@@ -268,6 +268,9 @@ Philiprehberger::TomlKit::Diff.identical?(old_config, new_config)
268
268
  | `TomlKit.save(hash, path)` | Write a Hash as a TOML file |
269
269
  | `TomlKit.parse_with_comments(string)` | Parse TOML preserving comments, returns `CommentDocument` |
270
270
  | `TomlKit.query(data, path, default:)` | Dot-path access into nested hashes |
271
+ | `TomlKit.set(data, path, value)` | Set a nested value by dot-path; creates intermediate hashes as needed |
272
+ | `TomlKit.delete(data, path)` | Delete a nested key by dot-path; returns the removed value or `nil` |
273
+ | `TomlKit.exists?(data, path)` | Check whether a dot-path resolves to a value |
271
274
  | `TomlKit.merge(left, right, strategy:)` | Deep merge two hashes with conflict resolution |
272
275
  | `TomlKit.diff(left, right)` | Compare two hashes, returns array of `Diff::Change` |
273
276
  | `Schema.new(properties)` | Create a schema for validation |
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module TomlKit
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -85,6 +85,36 @@ module Philiprehberger
85
85
  Query.get(data, path, default: default)
86
86
  end
87
87
 
88
+ # Set a nested value using a dot-path. Creates intermediate hashes/arrays
89
+ # as needed and mutates `data` in place. Returns the value that was set.
90
+ #
91
+ # @param data [Hash] target hash
92
+ # @param path [String] dot-separated path (e.g., "database.host")
93
+ # @param value [Object] the value to set
94
+ # @return [Object] the value that was set
95
+ def self.set(data, path, value)
96
+ Query.set(data, path, value)
97
+ end
98
+
99
+ # Delete a value at the given dot-path. Returns the removed value or `nil`
100
+ # if the path did not resolve.
101
+ #
102
+ # @param data [Hash] target hash
103
+ # @param path [String] dot-separated path
104
+ # @return [Object, nil] the removed value, or nil
105
+ def self.delete(data, path)
106
+ Query.delete(data, path)
107
+ end
108
+
109
+ # Check whether a value exists at the given dot-path.
110
+ #
111
+ # @param data [Hash] target hash
112
+ # @param path [String] dot-separated path
113
+ # @return [Boolean]
114
+ def self.exists?(data, path)
115
+ Query.exists?(data, path)
116
+ end
117
+
88
118
  # Deep merge two TOML hashes.
89
119
  #
90
120
  # @param left [Hash] base hash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philiprehberger-toml_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Rehberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-15 00:00:00.000000000 Z
11
+ date: 2026-05-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Parse and generate TOML v1.0 documents with full type support including
14
14
  datetimes, inline tables, and array of tables. Zero dependencies.