Class: Samantha
Overview
Samantha’s role in life is to read the mapping file
Defined Under Namespace
Classes: MappingFile, MappingFileInitial
Instance Method Summary collapse
Methods inherited from Jeremy
#initialize, #list_of_web_files, #webfile
Constructor Details
This class inherits a constructor from Jeremy
Instance Method Details
#list_of_mapping_files ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/staticweb.rb', line 153 def list_of_mapping_files list = [] Dir.entries(@working_directory).each do |file| if file.match(".mapping") then list << MappingFileInitial.new(file, @working_directory + "/" + file) end end if list.size != 0 then return list else raise MissingFileType, "The Directory contains no files with extension .mapping" end end |
#mappingfile ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/staticweb.rb', line 162 def mappingfile list = [] list_of_mapping_files.each do |mapping| File.readlines(mapping.file_path).each do |line| unless line.match(/\[/) if line.match(/d+/) then list << MappingFile.new(mapping.file_name, mapping.file_path, line.split[0],line.split[1], line.split[2],line.split[3]) end end end end return list end |