class Nokogiri::XML::Document
def deconstruct_keys(keys)
Since v1.14.0
# => {:root=>nil}
doc.deconstruct_keys([:root])
doc = Nokogiri::XML::Document.new
*Example* of an empty document
# })}
# #(Text "\n")]
# #(Element:0x370 { name = "child", children = [ #(Text "\n")] }),
# #(Text "\n" + " "),
# children = [
# name = "root",
# #(Element:0x35c {
# => {:root=>
doc.deconstruct_keys([:root])
XML
doc = Nokogiri::XML.parse(<<~XML)
*Example*
by opening an issue or a discussion on the github project.
instructions. If you have a use case and would like this functionality, please let us know
In the future, other keys may allow accessing things like doctype and processing
- +root+ → (Node, nil) The root node of the Document, or +nil+ if the document is empty.
Valid keys and their values:
Returns a hash describing the Document, to use in pattern matching.
:call-seq: deconstruct_keys(array_of_names) → Hash
def deconstruct_keys(keys) { root: root } end