lib/eternity/patch.rb in eternity-0.1.2 vs lib/eternity/patch.rb in eternity-0.1.3

- old
+ new

@@ -20,11 +20,11 @@ def base_commit @base_commit ||= Commit.base_of current_commit, target_commit end - def delta + def delta @delta ||= TransparentProxy.new { calculate_delta } end def base_history @base_history ||= [base_commit] + base_commit.history @@ -45,16 +45,16 @@ private def calculate_delta base_commit.with_index do |base_index| current_commit.with_index do |current_index| - + current_delta = Delta.merge current_history.reverse.map(&:delta), base_index target_delta = Delta.merge target_history.reverse.map(&:delta), base_index revert_delta = Delta.revert current_delta, base_index - merged_delta = merge_deltas current_delta, target_delta, revert_delta, base_index + merged_delta = merge_deltas target_delta, revert_delta, base_index merged_delta.each_with_object({}) do |(collection, elements), hash| hash[collection] = {} elements.each do |id, change| @@ -90,11 +90,11 @@ def calculate_delta return {} if merged? super end - def merge_deltas(current_delta, target_delta, revert_delta, base_index) + def merge_deltas(target_delta, revert_delta, base_index) remaining_delta = Delta.merge remaining_history.reverse.map(&:delta), base_index Delta.merge [revert_delta, target_delta, remaining_delta], base_index end end @@ -104,10 +104,10 @@ include Common private - def merge_deltas(current_delta, target_delta, revert_delta, base_index) + def merge_deltas(target_delta, revert_delta, base_index) Delta.merge [revert_delta, target_delta], base_index end end