class Nokogiri::XML::Namespace

def deconstruct_keys(keys)


Since v1.14.0

# => {:prefix=>"noko", :href=>"http://nokogiri.org/ns/noko"}
doc.root.elements.last.namespace.deconstruct_keys([:prefix, :href])

# })
# href = "http://nokogiri.org/ns/noko"
# prefix = "noko",
# => #(Namespace:0x370 {
doc.root.elements.last.namespace

# => {:prefix=>nil, :href=>"http://nokogiri.org/ns/default"}
doc.root.elements.first.namespace.deconstruct_keys([:prefix, :href])

# => #(Namespace:0x35c { href = "http://nokogiri.org/ns/default" })
doc.root.elements.first.namespace

XML





doc = Nokogiri::XML.parse(<<~XML)

*Example*

- +href+ → (String) The namespace's URI
- +prefix+ → (String, nil) The namespace's prefix, or +nil+ if there is no prefix (e.g., default namespace).
Valid keys and their values:

Returns a hash describing the Namespace, to use in pattern matching.

:call-seq: deconstruct_keys(array_of_names) → Hash
def deconstruct_keys(keys)
  { prefix: prefix, href: href }
end

def inspect_attributes

def inspect_attributes
  [:prefix, :href]
end