module IPIPX
Public Class Methods
data_loaded?()
click to toggle source
# File lib/ipip.rb, line 50 def data_loaded? @data_was_loaded ||= false end
find(ip)
click to toggle source
# File lib/ipip.rb, line 33 def find(ip) raise 'pls call `IPIPX.load_data!` first' unless data_loaded? ipv4_database.find(ip) end
ipv4_database(data_file = nil)
click to toggle source
# File lib/ipip.rb, line 46 def ipv4_database(data_file = nil) @ipv4_database ||= IPv4DatabaseX.new(data_file) end
load_data!(data_file)
click to toggle source
# File lib/ipip.rb, line 39 def load_data!(data_file) raise 'No such file' unless File.exists?(data_file) ipv4_database(data_file) @data_was_loaded = true end