lib/snmp/open/parser.rb in snmp-open-0.3.0 vs lib/snmp/open/parser.rb in snmp-open-0.3.1

- old
+ new

@@ -33,11 +33,11 @@ table(columns) end private - def table(columns) + def align(columns) indexes = columns.first.map { |value| index_using_first_oid(value) } hash = columns.flat_map { |row| row.map { |v| [v.oid, v] } }.to_h indexes.map do |index| @oids.map do |base| @@ -95,9 +95,17 @@ ['No Such Instance', nil] elsif !type ['STRING', token] else [type, tokens.next] + end + end + + def table(columns) + if columns.size == 1 && columns.all? { |column| column.size == 1 } + columns + else + align(columns) end end def indexes(columns) indexes = SortedSet.new