Class: Rugged::Blob::HashSignature
- Inherits:
-
Object
- Object
- Rugged::Blob::HashSignature
- Defined in:
- lib/rugged/blob.rb,
ext/rugged/rugged_blob.c
Constant Summary collapse
- WHITESPACE_DEFAULT =
0
- WHITESPACE_IGNORE =
1
- WHITESPACE_SMART =
2
Class Method Summary collapse
Class Method Details
.compare(rb_sig_a, rb_sig_b) ⇒ Object
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
# File 'ext/rugged/rugged_blob.c', line 670
static VALUE rb_git_blob_sig_compare(VALUE self, VALUE rb_sig_a, VALUE rb_sig_b)
{
git_hashsig *sig_a;
git_hashsig *sig_b;
int result;
if (!rb_obj_is_kind_of(rb_sig_a, rb_cRuggedBlobSig) ||
!rb_obj_is_kind_of(rb_sig_b, rb_cRuggedBlobSig)) {
rb_raise(rb_eTypeError, "Expected Rugged::Blob::HashSignature");
}
Data_Get_Struct(rb_sig_a, git_hashsig, sig_a);
Data_Get_Struct(rb_sig_b, git_hashsig, sig_b);
result = git_hashsig_compare(sig_a, sig_b);
if (result < 0)
rugged_exception_check(result);
return INT2FIX(result);
}
|
.new(*args) ⇒ Object
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
# File 'ext/rugged/rugged_blob.c', line 641
static VALUE rb_git_blob_sig_new(int argc, VALUE *argv, VALUE klass)
{
int error, opts = 0;
git_hashsig *sig;
VALUE rb_blob, rb_options;
if (rb_scan_args(argc, argv, "11", &rb_blob, &rb_options) == 2) {
Check_Type(rb_options, T_FIXNUM);
opts = FIX2INT(rb_options);
}
if (rb_obj_is_kind_of(rb_blob, rb_cRuggedBlob)) {
git_blob *blob;
TypedData_Get_Struct(rb_blob, git_blob, &rugged_object_type, blob);
error = git_hashsig_create(&sig,
git_blob_rawcontent(blob),
git_blob_rawsize(blob),
opts);
} else {
Check_Type(rb_blob, T_STRING);
error = git_hashsig_create(&sig, RSTRING_PTR(rb_blob), RSTRING_LEN(rb_blob), opts);
}
rugged_exception_check(error);
return Data_Wrap_Struct(klass, NULL, &git_hashsig_free, sig);
}
|