Method: Rugged::Blame#for_line

Defined in:
ext/rugged/rugged_blame.c

#for_line(line_no) ⇒ Object

Returns the blame hunk data for the given line_no in blame. Line number counting starts with 1.

[View source]

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'ext/rugged/rugged_blame.c', line 158

static VALUE rb_git_blame_for_line(VALUE self, VALUE rb_line_no)
{
	git_blame *blame;
	int line_no;

	Data_Get_Struct(self, git_blame, blame);
	Check_Type(rb_line_no, T_FIXNUM);

	line_no = NUM2INT(rb_line_no);

	if (line_no < 0) {
		rb_raise(rb_eArgError, "line number can't be negative");
	}

	return rb_git_blame_hunk_fromC(
		git_blame_get_hunk_byline(blame, (uint32_t)line_no)
	);
}