Skip to content

Commit fbc009f

Browse files
xprazak2dLobatog
authored andcommitted
Restore ruby 2.0 compatibility (#2)
1 parent dd5955d commit fbc009f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/openscap_parser/ds.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ def profiles
1717

1818
def profile_nodes
1919
@report_xml.xpath(".//Profile").map do |node|
20-
id = node.attribute('id')&.value
21-
title = node.at_xpath('./title')&.text
22-
description = node.at_xpath('./description')&.text
20+
id_node = node.attribute('id')
21+
id = id_node.value if id_node
22+
title_node = node.at_xpath('./title')
23+
title = title_node.text if title_node
24+
desc_node = node.at_xpath('./description')
25+
description = desc_node.text if desc_node
2326
{ :id => id, :title => title, :description => description }
2427
end
2528
end

0 commit comments

Comments
 (0)