lib/irrc/query.rb in irrc-0.1.0 vs lib/irrc/query.rb in irrc-0.2.0

- old
+ new

@@ -38,10 +38,12 @@ # Public: Register aut-num object(s) as a result. # # autnums - aut-num object(s) in String. Array form is also acceptable for multiple objects. def add_aut_num_result(autnums) + result = root.result + @protocols.each do |protocol| result[protocol] ||= {} Array(autnums).each do |autnum| result[protocol][autnum] ||= [] @@ -54,12 +56,14 @@ # prefixes - route object(s) in String. Array form is also acceptable for multiple objects. # autnum - Which aut-num has the route object(s). # protocol - Which protocol the route object(s) is for. :ipv4 or :ipv6. # A String or Symbol of protcol name is acceptable. def add_prefix_result(prefixes, autnum, protocol) + result = root.result + result[protocol] ||= {} result[protocol][autnum] ||= [] - result[protocol][autnum] |= Array(prefixes) + result[protocol][autnum].push *Array(prefixes) end private