summaryrefslogtreecommitdiff
path: root/report/util.rb
diff options
context:
space:
mode:
authorMartin Gütlein <martin.guetlein@gmail.com>2010-03-30 16:49:46 +0200
committerMartin Gütlein <martin.guetlein@gmail.com>2010-03-30 16:49:46 +0200
commit1a9419d158ede2535ae10b84d044da6a2cf89cfa (patch)
tree885b03c9018e78d61bf497bda8addc925d2857ae /report/util.rb
parentae0b071c42c37ea974aa234f30a3a8cb77aa7eb3 (diff)
mostly munich changes
Diffstat (limited to 'report/util.rb')
-rw-r--r--report/util.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/report/util.rb b/report/util.rb
index 5934064..ca12963 100644
--- a/report/util.rb
+++ b/report/util.rb
@@ -1,7 +1,23 @@
-
+require 'abbrev'
# graph-files are generated in the tmp-dir before they are stored
ENV['TMP_DIR'] = File.join(FileUtils.pwd,"reports","tmp") unless ENV['TMP_DIR']
+
+class Array
+ def common_prefix()
+ self.abbrev.keys.sort_by{|word| -word.size}.last[0..-2]
+ end
+
+ def remove_common_prefix()
+ if self.size > 2
+ prefix = self.common_prefix
+ if prefix.size>0
+ return self.collect{|word| word[prefix.size..-1]}
+ end
+ end
+ end
+end
+
class Object
# checks weather two objects have the same values for __equal_attributes__