Sha256: a0bdffea51d6f2f1237a921c7ebb68073304d11a6a3cf125d88988214dc4cde2

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 Bytes

Contents

require 'ipaddr'

module Irrc
  module Prefix
    private

    def classify_by_protocol(prefixes)
      Array(prefixes).each_with_object(Struct.new(:ipv4, :ipv6).new([], [])) {|prefix, result|
        addr = IPAddr.new(prefix)
        if addr.ipv4?
          result.ipv4 << prefix
        elsif addr.ipv6?
          result.ipv6 << prefix
        end
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
irrc-0.2.2 lib/irrc/prefix.rb
irrc-0.2.1 lib/irrc/prefix.rb
irrc-0.2.0 lib/irrc/prefix.rb