lib/wmap/url_crawler/adware_tag.rb
# load the known tag signatures into an instance variable
load the known tag signatures into an instance variable
load the known tag signatures into an instance variable
def load_sig_from_file (file, lc=true)
      puts "Loading data file: #{file}"	if @verbose
			data_store=Hash.new
			f = File.open(file, 'r')
			f.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 data_store.key?(entry[0])
					next
				else
					data_store[entry[0]]=entry[1].strip
				end
			end
			f.close
			return data_store
		rescue => ee
			puts "Exception on method #{__method__}: #{ee}" if @verbose
			return nil
  	end
def load_sig_from_file ( file , lc = true ) puts "Loading data file: #{file}" if @verbose data_store = Hash . new f = File . open ( file , 'r' ) f . 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 data_store . key? ( entry [ 0 ] ) next else data_store [ entry [ 0 ] ] = entry [ 1 ] . strip end end f . close return data_store rescue => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return nil end
load the known tag signatures into an instance variable
load the known tag signatures into an instance variable
file
<not_specific>
lc
<not_specific>