• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / 7fde352f-4bc4-4b4c-bc2b-821ce4858ea9

10 Nov 2025 09:08PM UTC coverage: 91.073% (-0.1%) from 91.201%
7fde352f-4bc4-4b4c-bc2b-821ce4858ea9

Pull #2162

circleci

Precilla Prempeh
Adding the windows external pop icon
Co-authored-by: Robert-Anthony Lee-Faison <leefaisonr@users.noreply.github.com>
Pull Request #2162: Made "select HPC clusters" & "Globus" clickable and both link open new tabs

2836 of 3114 relevant lines covered (91.07%)

548.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/lib/xml_utilities.rb
1
# frozen_string_literal: true
2
require "yaml"
2✔
3

4
# frozen_string_literal: true
5
TYPENAMES = { 1 => "element", 2 => "attribute", 3 => "text", 4 => "cdata", 8 => "comment" }.freeze
2✔
6

7
def xml_node_to_hash(node)
2✔
8
  # Based on https://stackoverflow.com/a/10144623
9
  h = {}
6✔
10
  h[:name] = node.name
6✔
11
  # For our needs, I think the type name clear from context.
12
  # node_type_name = TYPENAMES[node.node_type]
13
  # if node_type_name != "element"
14
  #   h[:name] += " (#{node_type_name})"
15
  # end
16
  if node.namespace
6✔
17
    h[:nshref] = node.namespace.href
×
18
    h[:nsprefix] = node.namespace.prefix
×
19
  end
20
  h[:text] = node.text unless node.text.empty?
6✔
21
  h[:attributes] = node.attribute_nodes.map { |attr_node| xml_node_to_hash(attr_node) } if node.element? && !node.attribute_nodes.empty?
8✔
22
  h[:subelements] = node.children.map { |child_node| xml_node_to_hash(child_node) } if node.element? && !node.children.empty?
7✔
23
  h
6✔
24
end
25

26
def xml_doc_to_hash(document)
2✔
27
  xml_node_to_hash(document.root)
3✔
28
end
29

30
def xml_doc_to_html(document)
2✔
31
  as_hash = xml_doc_to_hash(document)
2✔
32
  as_yaml = YAML.dump(as_hash).gsub(/\A---\n/, "")
2✔
33
  "<pre>#{CGI.escapeHTML(as_yaml)}</pre>"
2✔
34
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc