lib/echi-converter.rb in echi-converter-0.4.0 vs lib/echi-converter.rb in echi-converter-0.4.1

- old
+ new

@@ -83,10 +83,20 @@ rescue => err @log.warn err end end + #Method to strip special characters from a string + def strip_specials(data) + if $config["strip_characters"] == true + $config["characters_to_strip"].to_a.each do |char| + data.gsub!(char.chr,"") + end + end + return data + end + #Set the working directory to copy processed files to, if it does not exist creat it #Directory names based on year/month so as not to exceed 5K files in a single directory def set_directory working_directory @log.debug "set_directory method" time = Time.now @@ -260,9 +270,12 @@ bool_cnt = 0 end else #Process 'standard' fields value = dump_binary field["type"], field["length"] + if field["type"] == 'str' + value = strip_specials(value) + end @log.debug field["name"] + " { type => #{field["type"]} & length => #{field["length"]} } value => " + value.to_s end echi_record[field["name"]] = value end echi_record.save \ No newline at end of file