lib/vnstat/interface_collection.rb in vnstat-ruby-3.0.5 vs lib/vnstat/interface_collection.rb in vnstat-ruby-3.0.6
- old
+ new
@@ -96,12 +96,13 @@
private
def interfaces_hash
@interfaces_hash ||= begin
+ id_attr = xml_version == '2' ? :name : :id
elements = data.xpath('//interface')
elements.each_with_object({}) do |node, hash|
- id = node[:id]
+ id = node[id_attr]
hash[id] = Interface.new(id, data)
end
end
end
end