Sha256: 6cd863019079ccd6bcba2ae9c4ee87aa5eb25b687f8441b23bfb26b0a4cd624f

Contents?: true

Size: 347 Bytes

Versions: 7

Compression:

Stored size: 347 Bytes

Contents

# frozen_string_literal: true

require "ipaddr"

class Netdisco
  class PollMap
    attr_reader :poll

    # 类对象初始化函数入口
    def initialize
      @poll = CFG.poll.map { |cidr| IPAddr.new cidr }
    end

    # 判断是否包含某个地址
    def include?(addr)
      @poll.any? { |cidr| cidr.include? addr }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
netdisco-0.0.8 lib/netdisco/poll_map.rb
netdisco-0.0.7 lib/netdisco/poll_map.rb
netdisco-0.0.6 lib/netdisco/poll_map.rb
netdisco-0.0.5 lib/netdisco/poll_map.rb
netdisco-0.0.4 lib/netdisco/poll_map.rb
netdisco-0.0.3 lib/netdisco/poll_map.rb
netdisco-0.0.2 lib/netdisco/poll_map.rb