Class: IpFilter::List

Inherits:
Object
  • Object
show all
Defined in:
lib/ip_filter/list.rb

Direct Known Subclasses

BlackList, WhiteList

Instance Method Summary collapse

Constructor Details

#initialize(*list) ⇒ List

Returns a new instance of List.



4
5
6
# File 'lib/ip_filter/list.rb', line 4

def initialize(*list)
  @list = list.flatten.map { |ip| IPAddr.new(ip) }
end

Instance Method Details

#any?(remote_ip) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/ip_filter/list.rb', line 8

def any?(remote_ip)
  @list.any? { |ip| ip.include?(remote_ip) }
end