philiprehberger-toml_kit 0.2.4 → 0.3.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +10 -0
- data/lib/philiprehberger/toml_kit/version.rb +1 -1
- data/lib/philiprehberger/toml_kit.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 174ea153b4049cb9bfa03861fcfd17b0a1d6ca732c77bee833596261d8c3ac73
|
|
4
|
+
data.tar.gz: 9bcc85d52e0186652cee5b9304c4673da3f66d0eec8a4ff70ecd2bdfc856635b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e45be50d82be1e07d068a2932aa9c5889f5f2ae3a9fde62ec76850d9df3e9b3297ce3fa2fd46999af8f8fbc2e47e49ca1f5c89f3f5c0d8bd00e11fb7ea05d687
|
|
7
|
+
data.tar.gz: d65fe1af77f1fb87a56a4270e5bc2a7624fec1f75cab35bf56a24bc6f69369c9b5464991870475abe166b785626d64e23788141dfc68d8e3f6ea4a9baf6e0ccb
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.0] - 2026-04-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `TomlKit.valid?(string)` predicate for checking whether a string parses as TOML without raising
|
|
14
|
+
|
|
10
15
|
## [0.2.4] - 2026-04-09
|
|
11
16
|
|
|
12
17
|
### Fixed
|
data/README.md
CHANGED
|
@@ -56,6 +56,15 @@ config["database"]["host"] # => "localhost"
|
|
|
56
56
|
config["servers"][0]["name"] # => "alpha"
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
### Validity Check
|
|
60
|
+
|
|
61
|
+
Check whether a string is valid TOML without raising:
|
|
62
|
+
|
|
63
|
+
```ruby
|
|
64
|
+
Philiprehberger::TomlKit.valid?('key = "value"') # => true
|
|
65
|
+
Philiprehberger::TomlKit.valid?('key = [broken') # => false
|
|
66
|
+
```
|
|
67
|
+
|
|
59
68
|
### Loading Files
|
|
60
69
|
|
|
61
70
|
```ruby
|
|
@@ -253,6 +262,7 @@ Philiprehberger::TomlKit::Diff.identical?(old_config, new_config)
|
|
|
253
262
|
| Method | Description |
|
|
254
263
|
|--------|-------------|
|
|
255
264
|
| `TomlKit.parse(string)` | Parse a TOML string into a Hash |
|
|
265
|
+
| `TomlKit.valid?(string)` | Return `true` if the string parses as valid TOML |
|
|
256
266
|
| `TomlKit.load(path)` | Parse a TOML file into a Hash |
|
|
257
267
|
| `TomlKit.dump(hash)` | Serialize a Hash to a TOML string |
|
|
258
268
|
| `TomlKit.save(hash, path)` | Write a Hash as a TOML file |
|
|
@@ -29,6 +29,17 @@ module Philiprehberger
|
|
|
29
29
|
Parser.new.parse(string)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Check whether a string parses as valid TOML without raising.
|
|
33
|
+
#
|
|
34
|
+
# @param string [String] TOML document
|
|
35
|
+
# @return [Boolean] true if the string is valid TOML
|
|
36
|
+
def self.valid?(string)
|
|
37
|
+
parse(string)
|
|
38
|
+
true
|
|
39
|
+
rescue ParseError
|
|
40
|
+
false
|
|
41
|
+
end
|
|
42
|
+
|
|
32
43
|
# Parse a TOML file into a Ruby Hash.
|
|
33
44
|
#
|
|
34
45
|
# @param path [String] path to a TOML file
|
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.
|
|
4
|
+
version: 0.3.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-
|
|
11
|
+
date: 2026-04-15 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.
|