diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-07 14:40:33 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-12-07 14:40:33 +0000 |
commit | ea603e4ea5667be48440616f6a5f72b89a60c834 (patch) | |
tree | 7827e3b7f24a16599b23386fa71f055b1e29630a /lib/redmine/unified_diff.rb | |
parent | 0ea3d150e127a1b69c67b31495d633a56edcbbfa (diff) | |
download | redmine-ea603e4ea5667be48440616f6a5f72b89a60c834.tar.gz redmine-ea603e4ea5667be48440616f6a5f72b89a60c834.zip |
Use options hash in UnifiedDiff.new
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2110 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/unified_diff.rb')
-rw-r--r-- | lib/redmine/unified_diff.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb index 36a36cba5..5408a1ef9 100644 --- a/lib/redmine/unified_diff.rb +++ b/lib/redmine/unified_diff.rb @@ -18,14 +18,16 @@ 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 |