class Rack::IpRestrictor::IpGroup
Stores and handles groups of IP’s added as String, converted into hash of IpAddr
Public Class Methods
new()
click to toggle source
# File lib/rack_ip_restrictor/ip_group.rb, line 5 def initialize @addresses = {} end
Public Instance Methods
add(ip_arg)
click to toggle source
Adds an IP address to the list of addresses as instance of IPAddr
@param [String] ip_arg IP address as String
# File lib/rack_ip_restrictor/ip_group.rb, line 12 def add(ip_arg) @addresses[ip_arg] = IPAddr.new(ip_arg) end
include?(remote_addr)
click to toggle source
@param [IpAddr] remote_addr The IP address of the requester
# File lib/rack_ip_restrictor/ip_group.rb, line 22 def include?(remote_addr) @addresses.each do |key, value| return true if value.include? remote_addr end false end
ips()
click to toggle source
@return [Array] Keys of addresses set
# File lib/rack_ip_restrictor/ip_group.rb, line 17 def ips @addresses.keys end