Use options hash in UnifiedDiff.new
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2110 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0ea3d150e1
commit
ea603e4ea5
|
@ -18,14 +18,16 @@
|
||||||
module Redmine
|
module Redmine
|
||||||
# Class used to parse unified diffs
|
# Class used to parse unified diffs
|
||||||
class UnifiedDiff < Array
|
class UnifiedDiff < Array
|
||||||
def initialize(diff, type="inline")
|
def initialize(diff, options={})
|
||||||
diff_table = DiffTable.new type
|
diff_type = options[:type] || 'inline'
|
||||||
|
|
||||||
|
diff_table = DiffTable.new(diff_type)
|
||||||
diff.each do |line|
|
diff.each do |line|
|
||||||
if line =~ /^(---|\+\+\+) (.*)$/
|
if line =~ /^(---|\+\+\+) (.*)$/
|
||||||
self << diff_table if diff_table.length > 1
|
self << diff_table if diff_table.length > 1
|
||||||
diff_table = DiffTable.new type
|
diff_table = DiffTable.new(diff_type)
|
||||||
end
|
end
|
||||||
a = diff_table.add_line line
|
diff_table.add_line line
|
||||||
end
|
end
|
||||||
self << diff_table unless diff_table.empty?
|
self << diff_table unless diff_table.empty?
|
||||||
self
|
self
|
||||||
|
|
Loading…
Reference in New Issue