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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 720c31767f0706544320e00c6fb4ed6e3dd946f601c68c947c6eaf409c324dd2
4
- data.tar.gz: a8dafaef9908d5f485cdf57fc65654a8b11610e93575a27f78b668f6b9e342e4
3
+ metadata.gz: c3469bf0da4d625250b3e99c2659f1c5299d344a7b6b7f60f24af0cc9fd07f71
4
+ data.tar.gz: c806ec833b1d176a5907fb977c39c54b3e35f1103314cd2abfd335b260faff39
5
5
  SHA512:
6
- metadata.gz: 466443cf83706000e5ae81f7a8fd5cf673cb7aad9306a4de70d189182af0459e75a415b047063af46feaffe227342f3c1b51ac8288e312cca5ba2983efd38233
7
- data.tar.gz: 5c904af4d1da2f0899771115ac35632ebd0c871c65236e24a98001522821a23e93d003723c4b4b98470da8579d8267a52443ba91243e16e46571a76fd6164515
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module XmlBuilder
5
- VERSION = '0.4.0'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
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.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-04-16 00:00:00.000000000 Z
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.