jsgoecke-echi_files 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,12 @@
1
+ == 0.0.1 2009-01-10
2
+
3
+ * 1 major enhancement(s):
4
+ * Initial release
5
+ * Alpha phase
6
+
7
+ == 0.0.2 2009-01-19
8
+
9
+ * Minor enhancement(s):
10
+ * Added full tests
11
+ * Refactored and changed the name of the strip_special_characters_method
12
+
data/echi_files.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "echi_files"
3
- s.version = "0.1.0"
3
+ s.version = "0.2.0"
4
4
  s.date = "2009-01-19"
5
5
  s.summary = "Ruby Library for Processing Avaya ECHI Files"
6
6
  s.description = "Ruby Library for processing External Call History (ECHI) files from the Avaya CMS"
@@ -12,7 +12,14 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = ["lib/echi_files.rb",
14
14
  "lib/extended-definition.yml",
15
- "lib/standard-definition.yml",
15
+ "lib/standard-definition.yml",
16
+ "test/example_ascii_file",
17
+ "test/example_binary_file",
18
+ "test/proper_ascii.yml",
19
+ "test/proper_stripped.yml",
20
+ "test/proper_unstripped.yml",
21
+ "test/test_echi_files.rb",
22
+ "History.txt",
16
23
  "LICENSE",
17
24
  "README.textile",
18
25
  "echi_files.gemspec"]
data/lib/echi_files.rb CHANGED
@@ -27,7 +27,6 @@ class EchiFiles
27
27
  case length
28
28
  when 4
29
29
  value = filehandle.read(length).unpack("l").first.to_i
30
- puts value.inspect
31
30
  value = Time.at(value)
32
31
  end
33
32
  #Process strings
@@ -168,13 +167,18 @@ class EchiFiles
168
167
 
169
168
  #Method used to strip special characters
170
169
  #@data An Array of Hashes to be processed
171
- #@characters An Array of charcters to be stripped
172
- def strip_asaiuui(data, characters)
173
-
170
+ #@fields An array of fields to strip characters from
171
+ #@characters An Array of characters to be stripped
172
+ def strip_special_characters(data, fields, characters)
173
+
174
174
  stripped_data = Array.new
175
175
  data.each do |row|
176
- characters.each do |char|
177
- row["asaiuui"].gsub!(char.chr,"")
176
+ fields.each do |field|
177
+ if field == row[0]
178
+ characters.each do |character|
179
+ row[1].gsub!(character.chr, "")
180
+ end
181
+ end
178
182
  end
179
183
  stripped_data << row
180
184
  end