lib/wmap/domain_tracker.rb
# 'setter' to load the known Internet domains into an instance variable
'setter' to load the known Internet domains into an instance variable
' setter ' to load the known Internet domains into an instance variable
def load_domains_from_file (file=@domains_file, lc=true)
		puts "Loading trusted domain file: #{file}"	if @verbose
		@known_internet_domains=Hash.new
		f_domains=File.open(file, 'r')
		f_domains.each_line do |line|
			puts "Processing line: #{line}" if @verbose
			line=line.chomp.strip
			next if line.nil?
			next if line.empty?
			next if line =~ /^\s*#/
			line=line.downcase if lc==true
			entry=line.split(',')
			if @known_internet_domains.key?(entry[0])
				next
			else
				if entry[1] =~ /yes/i
					@known_internet_domains[entry[0]]=true
				else
					@known_internet_domains[entry[0]]=false
				end
			end
		end
		f_domains.close
		return @known_internet_domains
	rescue => ee
		puts "Exception on method #{__method__}: #{ee}" if @verbose
		return nil
	end
def load_domains_from_file ( file = @domains_file , lc = true ) puts "Loading trusted domain file: #{file}" if @verbose @known_internet_domains = Hash . new f_domains = File . open ( file , 'r' ) f_domains . each_line do | line | puts "Processing line: #{line}" if @verbose line = line . chomp . strip next if line . nil? next if line . empty? next if line =~ / ^ \s *# / line = line . downcase if lc == true entry = line . split ( ',' ) if @known_internet_domains . key? ( entry [ 0 ] ) next else if entry [ 1 ] =~ / yes /i @known_internet_domains [ entry [ 0 ] ] = true else @known_internet_domains [ entry [ 0 ] ] = false end end end f_domains . close return @known_internet_domains rescue => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return nil end
'setter' to load the known Internet domains into an instance variable
' setter ' to load the known Internet domains into an instance variable
file
<not_specific>
lc
<not_specific>