]> source.dussan.org Git - redmine.git/commitdiff
Use options hash in UnifiedDiff.new
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 7 Dec 2008 14:40:33 +0000 (14:40 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 7 Dec 2008 14:40:33 +0000 (14:40 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2110 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/unified_diff.rb

index 36a36cba558bd52d0e4e822853cdbdf92ca963fe..5408a1ef9375a15f233a5650c99322ec9a710d3e 100644 (file)
 module Redmine
   # Class used to parse unified diffs
   class UnifiedDiff < Array  
-    def initialize(diff, type="inline")
-      diff_table = DiffTable.new type
+    def initialize(diff, options={})
+      diff_type = options[:type] || 'inline'
+      
+      diff_table = DiffTable.new(diff_type)
       diff.each do |line|
         if line =~ /^(---|\+\+\+) (.*)$/
           self << diff_table if diff_table.length > 1
-          diff_table = DiffTable.new type
+          diff_table = DiffTable.new(diff_type)
         end
-        a = diff_table.add_line line
+        diff_table.add_line line
       end
       self << diff_table unless diff_table.empty?
       self