class EASYFPM::Mapping
Attributes
hashmap[R]
Public Class Methods
new(mappingfile)
click to toggle source
# File lib/easyfpm/mapping.rb, line 30 def initialize(mappingfile) file = File.open(mappingfile, 'r') @hashmap={} while !file.eof? line = file.readline #We ignore the empty lines next if @@regexpStruct[:emptyline].match(line) #We ignore the comment lines next if @@regexpStruct[:commentline].match(line) linematch = @@regexpStruct[:mappingline].match(line) if linematch #We are on a mapping line #Verifying that new path don't start with / raise EASYFPM::InvalidConfiguration, "New path can't start with / mapping file #{mappingfile}:\n\t#{line}" if linematch[2][0] == "/" @hashmap[linematch[1]]=linematch[2] else raise EASYFPM::InvalidConfiguration, "The following line is not recognized in mapping file #{mappingfile}:\n\t#{line}" end end end