Class: Rugged::OdbObject
- Inherits:
-
Object
- Object
- Rugged::OdbObject
- Defined in:
- ext/rugged/rugged_repo.c
Instance Method Summary collapse
-
#data ⇒ Object
Return an ASCII buffer with the raw bytes that form the Git object.
-
#size ⇒ Object
Return the size in bytes of the Git object after decompression.
-
#oid ⇒ Object
Return the Object ID (a 40 character SHA1 hash) for this raw object.
-
#type ⇒ Symbol
Return a Ruby symbol representing the basic Git type of this object.
Instance Method Details
#data ⇒ Object
Return an ASCII buffer with the raw bytes that form the Git object.
odb_obj.data #=> "tree 87ebee8367f9cc5ac04858b3bd5610ca74f04df9\n"
#=> "parent 68d041ee999cb07c6496fbdd4f384095de6ca9e1\n"
#=> "author Vicent Martà <[email protected]> 1326863045 -0800\n"
#=> ...
67 68 69 70 71 72 |
# File 'ext/rugged/rugged_repo.c', line 67
static VALUE rb_git_odbobj_data(VALUE self)
{
git_odb_object *obj;
TypedData_Get_Struct(self, git_odb_object, &rugged_odb_object_type, obj);
return rb_str_new(git_odb_object_data(obj), git_odb_object_size(obj));
}
|
#size ⇒ Object
Return the size in bytes of the Git object after decompression. This is also the size of the obj.data
buffer.
odb_obj.size #=> 231
83 84 85 86 87 88 |
# File 'ext/rugged/rugged_repo.c', line 83
static VALUE rb_git_odbobj_size(VALUE self)
{
git_odb_object *obj;
TypedData_Get_Struct(self, git_odb_object, &rugged_odb_object_type, obj);
return INT2FIX(git_odb_object_size(obj));
}
|
#oid ⇒ Object
Return the Object ID (a 40 character SHA1 hash) for this raw object.
odb_obj.oid #=> "d8786bfc97485e8d7b19b21fb88c8ef1f199fc3f"
49 50 51 52 53 54 |
# File 'ext/rugged/rugged_repo.c', line 49
static VALUE rb_git_odbobj_oid(VALUE self)
{
git_odb_object *obj;
TypedData_Get_Struct(self, git_odb_object, &rugged_odb_object_type, obj);
return rugged_create_oid(git_odb_object_id(obj));
}
|
#type ⇒ Symbol
Return a Ruby symbol representing the basic Git type of this object. Possible values are :tree
, :blob
, :commit
and :tag
.
odb_obj.type #=> :tag
99 100 101 102 103 104 |
# File 'ext/rugged/rugged_repo.c', line 99
static VALUE rb_git_odbobj_type(VALUE self)
{
git_odb_object *obj;
TypedData_Get_Struct(self, git_odb_object, &rugged_odb_object_type, obj);
return rugged_otype_new(git_odb_object_type(obj));
}
|