lib/roku_builder/plugins/profiler.rb in roku_builder-4.24.0 vs lib/roku_builder/plugins/profiler.rb in roku_builder-4.24.1

- old
+ new

@@ -136,12 +136,12 @@ end_reg = /<\/All_Nodes>/ start_reg = /<All_Nodes>/ lines = get_command_response(command: "sgnodes all", start_reg: start_reg, end_reg: end_reg) xml_string = lines.join("\n") stats = {"Total" => {count: 0}} - doc = Oga.parse_xml(xml_string) - handle_node(stats: stats, node: doc.children.first) + doc = Nokogiri::XML(xml_string) + handle_node(stats: stats, node: doc.root) stats end def print_stats(stats:) stats = stats.to_a @@ -169,11 +169,10 @@ end end def handle_node(stats:, node:) if node - node.children.each do |element| - next unless element.class == Oga::XML::Element + node.element_children.each do |element| attributes = element.attributes.map{|attr| {"#{attr.name}": attr.value}}.reduce({}, :merge) stats[element.name] ||= {count: 0, ids: []} stats[element.name][:count] += 1 stats[element.name][:ids].push(attributes[:name]) if attributes[:name] stats["Total"][:count] += 1