lib/wmap/url_crawler/adware_tag.rb
# load the known tag store cache into an instance variable
load the known tag store cache into an instance variable
load the known tag store cache into an instance variable
def load_tag_from_file (file, lc=false)
      puts "Loading tag data file: #{file}"	if @verbose
			@tag_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 @tag_store.key?(entry[0])
					next
				else
					@tag_store[entry[0]]=[entry[1].strip, entry[2].strip, entry[3], entry[4]]
				end
			end
			f.close
			return @tag_store
		rescue => ee
			puts "Exception on method #{__method__}: #{ee}" if @verbose
			return nil
  	end
def load_tag_from_file ( file , lc = false ) puts "Loading tag data file: #{file}" if @verbose @tag_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 @tag_store . key? ( entry [ 0 ] ) next else @tag_store [ entry [ 0 ] ] = [ entry [ 1 ] . strip , entry [ 2 ] . strip , entry [ 3 ] , entry [ 4 ] ] end end f . close return @tag_store rescue => ee puts "Exception on method #{__method__}: #{ee}" if @verbose return nil end
load the known tag store cache into an instance variable
load the known tag store cache into an instance variable
file
<not_specific>
lc
<not_specific>