Class: Netdisco::PollMap

Inherits:
Object
  • Object
show all
Defined in:
lib/netdisco/poll_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePollMap

类对象初始化函数入口



10
11
12
# File 'lib/netdisco/poll_map.rb', line 10

def initialize
  @poll = CFG.poll.map { |cidr| IPAddr.new cidr }
end

Instance Attribute Details

#pollObject (readonly)

Returns the value of attribute poll.



7
8
9
# File 'lib/netdisco/poll_map.rb', line 7

def poll
  @poll
end

Instance Method Details

#include?(addr) ⇒ Boolean

判断是否包含某个地址

Returns:

  • (Boolean)


15
16
17
# File 'lib/netdisco/poll_map.rb', line 15

def include?(addr)
  @poll.any? { |cidr| cidr.include? addr }
end