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
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 |
# File 'ext/rugged/rugged_blob.c', line 592 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
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'ext/rugged/rugged_blob.c', line 563 static VALUE rb_git_blob_sig_new(int argc, VALUE *argv, VALUE klass) { int error, opts = 0; git_hashsig *sig; VALUE rb_blob, ; if (rb_scan_args(argc, argv, "11", &rb_blob, &) == 2) { Check_Type(, T_FIXNUM); opts = FIX2INT(); } if (rb_obj_is_kind_of(rb_blob, rb_cRuggedBlob)) { git_blob *blob; Data_Get_Struct(rb_blob, git_blob, 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); } |