class Nokogiri::XML::Attr
def deconstruct_keys(keys)
Since v1.14.0
# })}
# href = "http://nokogiri.org/ns/noko"
# prefix = "noko",
# #(Namespace:0x384 {
# :namespace=>
# :value=>"def",
# => {:name=>"bar",
attributes.last.deconstruct_keys([:name, :value, :namespace])
# => {:name=>"foo", :value=>"abc", :namespace=>nil}
attributes.first.deconstruct_keys([:name, :value, :namespace])
# })]
# value = "def"
# }),
# href = "http://nokogiri.org/ns/noko"
# prefix = "noko",
# namespace = #(Namespace:0x384 {
# name = "bar",
# #(Attr:0x370 {
# => [#(Attr:0x35c { name = "foo", value = "abc" }),
attributes = doc.root.elements.first.attribute_nodes
XML
doc = Nokogiri::XML.parse(<<~XML)
*Example*
- +namespace+ → (Namespace, nil) The Namespace of the attribute, or +nil+ if there is no namespace.
- +value+ → (String) The value of the attribute.
- +name+ → (String) The name of the attribute.
Valid keys and their values:
Returns a hash describing the Attr, to use in pattern matching.
:call-seq: deconstruct_keys(array_of_names) → Hash
def deconstruct_keys(keys) { name: name, value: value, namespace: namespace } end
def inspect_attributes
def inspect_attributes [:name, :namespace, :value] end