philiprehberger-xml_builder 0.4.0 → 0.5.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 +11 -0
- data/lib/philiprehberger/xml_builder/document.rb +8 -0
- data/lib/philiprehberger/xml_builder/version.rb +1 -1
- 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: c3469bf0da4d625250b3e99c2659f1c5299d344a7b6b7f60f24af0cc9fd07f71
|
|
4
|
+
data.tar.gz: c806ec833b1d176a5907fb977c39c54b3e35f1103314cd2abfd335b260faff39
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d8b31224c876a05e5d71619d80ad32a6cff4b7df989b21344d6b7063313e5a7454f1fb58ad0a506f3b49205258d5c9a4937231368e37f82572c8dbaf47230d2
|
|
7
|
+
data.tar.gz: fe9aba2f34358d9f54fce39e6894fa3959aa1c8dc29588fcb568112c24eaf432e84909cec5c78716f149b8803c8cdff080ab23241060af8a0a67b20c4e3e4c19
|
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.5.0] - 2026-05-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `Document#pretty(indent: 2)` — convenience renderer for pretty-printed XML, equivalent to `to_xml(indent: 2)` but with sane defaults.
|
|
14
|
+
|
|
10
15
|
## [0.4.0] - 2026-04-16
|
|
11
16
|
|
|
12
17
|
### Added
|
data/README.md
CHANGED
|
@@ -104,6 +104,16 @@ puts doc.to_xml(indent: 2)
|
|
|
104
104
|
# </root>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
Or use `#pretty` for the same output with sane defaults:
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
puts doc.pretty
|
|
111
|
+
# Equivalent to doc.to_xml(indent: 2)
|
|
112
|
+
|
|
113
|
+
puts doc.pretty(indent: 4)
|
|
114
|
+
# Equivalent to doc.to_xml(indent: 4)
|
|
115
|
+
```
|
|
116
|
+
|
|
107
117
|
### Raw XML
|
|
108
118
|
|
|
109
119
|
```ruby
|
|
@@ -232,6 +242,7 @@ end
|
|
|
232
242
|
| `#insert_fragment(xml_string)` | Insert a raw XML fragment string |
|
|
233
243
|
| `#to_s` | Render compact XML string |
|
|
234
244
|
| `#to_xml(indent: nil)` | Render XML with optional indentation |
|
|
245
|
+
| `#pretty(indent: 2)` | Renders with default 2-space indentation |
|
|
235
246
|
|
|
236
247
|
### `Escaper`
|
|
237
248
|
|
|
@@ -108,6 +108,14 @@ module Philiprehberger
|
|
|
108
108
|
to_xml
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# Render the document as a pretty-printed XML string with default 2-space indentation.
|
|
112
|
+
#
|
|
113
|
+
# @param indent [Integer] number of spaces per indentation level (default 2)
|
|
114
|
+
# @return [String] the rendered XML document
|
|
115
|
+
def pretty(indent: 2)
|
|
116
|
+
to_xml(indent: indent)
|
|
117
|
+
end
|
|
118
|
+
|
|
111
119
|
# Render the document as an XML string with optional indentation.
|
|
112
120
|
#
|
|
113
121
|
# @param indent [Integer, nil] number of spaces per indentation level, or nil for compact output
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-xml_builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.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-
|
|
11
|
+
date: 2026-05-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Programmatic XML construction with a clean DSL, auto-escaping, CDATA,
|
|
14
14
|
comments, processing instructions, and pretty printing. Zero dependencies.
|