moxml 0.5.154 → 0.5.155

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: 05a5f1f4e5475fe30f9d821cc2630f8c6d9d95aa38fa5d2e46e25e51605d1504
4
- data.tar.gz: c47ee78ffb35d119b4a5c470e27e4dd0b9d3c4dfedba2c7d8bcc3aa17901d01b
3
+ metadata.gz: c6118a2cde5308a843923649c4d115a89c39f99a74e5cf5b0804c7c69ffe17ce
4
+ data.tar.gz: 97fd393417a588ed4ffea5c885982ead30553b76679c38edea3a466f8c093e23
5
5
  SHA512:
6
- metadata.gz: 012cb442259cd2496eacf056b75e8ed050203eb92673b608b379305de4215f8c00c65b83b72d70027c7b2adbd9fd90d5eb2f41701de62305e291f7118fa9a44a
7
- data.tar.gz: ceed6daf6824f3de929c14586b130fb014afc66b261bb3c76a92be0e09e1e33e4e41c8729f7a091dc80e71dbe36a67ffdffd66d454406e5a9a47494d634b294e
6
+ metadata.gz: 4471e50a04a8b3432a56555eb5f45edaecfd20b704dc890d6f89f5c076752f8350fe7c95b8e8c58b9569add68900619561ef685706161b0dee2c4275f2a54c12
7
+ data.tar.gz: 04f39ca1432d7e910485b9305e9fe4aa042890f6dd49b80981bc262846152d1ab8fa5d6ac5a584c000612a491bc3625849ee3ed5c65694d892f462787d007115
@@ -14,6 +14,18 @@ module Moxml
14
14
  had_source_declaration document_text
15
15
  ].freeze
16
16
 
17
+ # The XML declaration kind is not stable across leptris
18
+ # releases: 1.9.345-era builds lack Leptris::XML::Declaration
19
+ # entirely (the pure-Ruby CustomizedLeptris twin carries the
20
+ # declaration then), later builds expose it again (and list it
21
+ # among the document children, leptris-ruby#459). Resolve the
22
+ # kind set once, by feature detection, and filter both kinds —
23
+ # the shim twin is never a listing node either way.
24
+ DECLARATION_KINDS = [
25
+ ::Moxml::Adapter::CustomizedLeptris::Declaration,
26
+ (::Leptris::XML::Declaration if ::Leptris::XML.const_defined?(:Declaration)),
27
+ ].compact.freeze
28
+
17
29
  def free_document(native)
18
30
  DOCUMENT_ATTACHMENT_KEYS.each { |key| attachments.delete(native, key) }
19
31
  native.free
@@ -39,17 +51,11 @@ module Moxml
39
51
  # leptris-ruby#459 lists the declaration among the binding
40
52
  # children; the Nokogiri-shaped facade contract never lists
41
53
  # it (the declaration is a preamble part, not a child node)
42
- # — filtered at the listing seam. The constant is resolved
43
- # conditionally: leptris releases before the declaration
44
- # node class landed (e.g. 1.9.345) carry no Declaration at
45
- # all, and referencing the constant unconditionally raises
46
- # NameError on every document-children listing.
47
- declaration_class =
48
- if ::Leptris::XML.const_defined?(:Declaration, false)
49
- ::Leptris::XML::Declaration
50
- end
54
+ # — filtered at the listing seam.
51
55
  children.concat(
52
- doc.children.to_a.grep_v(declaration_class),
56
+ doc.children.to_a.reject do |child|
57
+ DECLARATION_KINDS.any? { |kind| child.is_a?(kind) }
58
+ end,
53
59
  )
54
60
 
55
61
  texts = attachments.get(doc, :document_text)
@@ -175,7 +181,7 @@ module Moxml
175
181
  # emission (a second line here duplicates it — and the
176
182
  # 1.9.360 0-arity Declaration#to_xml raises under the
177
183
  # options-passing call).
178
- next if child.is_a?(::Leptris::XML::Declaration)
184
+ next if DECLARATION_KINDS.any? { |kind| child.is_a?(kind) }
179
185
 
180
186
  parts << raw_serialize(child, options) << "\n"
181
187
  end
data/lib/moxml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Moxml
4
- VERSION = "0.5.154"
4
+ VERSION = "0.5.155"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.154
4
+ version: 0.5.155
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.