Class: Jpmobile::Mobile::IpAddresses::AbstractIpAddresses

Inherits:
Object
  • Object
show all
Defined in:
lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb

Direct Known Subclasses

Au, Docomo, Emobile, Softbank, Willcom

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ip_address_listObject



16
17
18
# File 'lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb', line 16

def ip_address_list
  []
end

Instance Method Details

#valid_ip?(remote_ip_str) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb', line 5

def valid_ip?(remote_ip_str)
  begin
    remote_ip = IPAddr.new(remote_ip_str)
  rescue
    return false
  end

  self.class.ip_address_list.any? {|ip| ip.include?(remote_ip)}
end