class Nokogiri::XML::Reader

def attributes

Returns:
  • (Hash) - Attribute names and values
def attributes
  attrs_hash = attribute_nodes.each_with_object({}) do |node, hash|
                 hash[node.name] = node.to_s
               end
  ns = namespaces
  attrs_hash.merge!(ns) if ns
  attrs_hash
end