Method: Rugged::Diff#each_delta

Defined in:
ext/rugged/rugged_diff.c

#each_delta {|delta| ... } ⇒ self #each_deltaObject

If given a block, yields each delta that is part of the diff. If no block is given, an enumerator will be returned.

This method should be preferred over #each_patch if you’re not interested in the actual line-by-line changes of the diff.

Overloads:

  • #each_delta {|delta| ... } ⇒ self

    Yields:

    • (delta)

    Returns:

    • (self)

477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'ext/rugged/rugged_diff.c', line 477

static VALUE rb_git_diff_each_delta(VALUE self)
{
	git_diff *diff;
	const git_diff_delta *delta;
	size_t d, delta_count;

	RETURN_ENUMERATOR(self, 0, 0);
	Data_Get_Struct(self, git_diff, diff);

	delta_count = git_diff_num_deltas(diff);
	for (d = 0; d < delta_count; ++d) {
		delta = git_diff_get_delta(diff, d);
		rb_yield(rugged_diff_delta_new(self, delta));
	}

	return self;
}