Skip to content

Commit

Permalink
fix(Values): RHICOMPL-3871 Correctly parse all values
Browse files Browse the repository at this point in the history
  • Loading branch information
marleystipich2 committed Jul 7, 2023
1 parent 6ac040d commit 2a24af9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/openscap_parser/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ def generic_selector(type, selector = nil)

unless cache
element_name = type.to_s.sub('_', '-')

cache = parsed_xml.xpath(element_name).each_with_object({}) do |element, elements|
elements[element.at_xpath('@selector')&.text.presence] = element&.text
elements[element.at_xpath('@selector')&.text] = element&.text
end
instance_variable_set("@#{type}", cache)
end

return cache[selector] if selector

cache[nil] || cache.values.first
cache[nil] || cache[''] || cache.values.first
end

def upper_bound(selector = nil)
Expand Down

0 comments on commit 2a24af9

Please sign in to comment.