lib/wmap/utils/utils.rb
# Load entries from a text file and return an array
Load entries from a text file and return an array
Load entries from a text file and return an array
def file_2_list(f,lc=true)
		puts "Loading records from file: #{f}" if @verbose
		begin
			list=Array.new
			file = File.open(f, "r")
			file.each_line do |line|
				line=line.chomp.strip
				next if line.nil?
				next if line.empty?
				next if line =~ /^\s*#/
				line=line.downcase if lc==true
				list.push(line.chomp.strip)
			end
			file.close
			return list
		rescue => ee
			puts "Exception on method #{__method__} for file #{f}: #{ee}" if @verbose
			return nil
		end
	end
def file_2_list ( f , lc = true ) puts "Loading records from file: #{f}" if @verbose begin list = Array . new file = File . open ( f , "r" ) file . each_line do | line | line = line . chomp . strip next if line . nil? next if line . empty? next if line =~ / ^ \s *# / line = line . downcase if lc == true list . push ( line . chomp . strip ) end file . close return list rescue => ee puts "Exception on method #{__method__} for file #{f}: #{ee}" if @verbose return nil end end
Load entries from a text file and return an array
Load entries from a text file and return an array
f
<not_specific>
lc
<not_specific>