Class: Archive::Entry

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
ext/entry.cpp

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object

entry <=> other -> -1,0,1 or nil

compares two entries



168
169
170
171
172
173
174
175
# File 'ext/entry.cpp', line 168

VALUE _compare(VALUE self,VALUE other)
{
	if(rb_obj_is_kind_of(other,rb_cArchiveEntry) != Qtrue)
		return Qnil;
	else {
		return rb_funcall(_get_mtime(self),rb_intern("<=>"),1,_get_mtime(other));
	}
}

#access_aclObject

ACL added later with acl gem



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'ext/entry.cpp', line 222

VALUE ArchiveEntry_access_acl(VALUE self){
	if(rb_const_defined(rb_cObject,rb_intern("ACL"))){
		VALUE rb_cAcl = rb_const_get(rb_cObject,rb_intern("ACL"));
		VALUE rb_cAclEntry = rb_const_get(rb_cObject,rb_intern("Entry"));
		VALUE result = rb_class_new_instance(0,NULL,rb_cAcl);
		archive_entry_acl_reset(_self,ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
		int type,permset,tag,qual;
		const char* name;
		while(archive_entry_acl_next(_self, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,&type, &permset, &tag,&qual, &name) == 0){
			VALUE entry;
			VALUE temp[3];
			switch(tag){
			case ARCHIVE_ENTRY_ACL_USER:
			case ARCHIVE_ENTRY_ACL_USER_OBJ:
				temp[0] = ID2SYM(rb_intern("user"));
				break;
			case ARCHIVE_ENTRY_ACL_GROUP:
			case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
				temp[0] = ID2SYM(rb_intern("group"));
				break;
			case ARCHIVE_ENTRY_ACL_MASK:
				temp[0] = ID2SYM(rb_intern("mask"));
				break;
			case ARCHIVE_ENTRY_ACL_OTHER:
				temp[0] = ID2SYM(rb_intern("other"));
				break;
			}
			temp[1] = INT2NUM(permset);
			switch(tag){
			case ARCHIVE_ENTRY_ACL_USER:
			case ARCHIVE_ENTRY_ACL_GROUP:
				temp[2] = INT2NUM(qual);
				entry=rb_class_new_instance(3,temp,rb_cAclEntry);
				break;
			default:
				entry=rb_class_new_instance(2,temp,rb_cAclEntry);
				break;
			}
			rb_funcall(result,rb_intern("<<"),1,entry);
		}
		return result;
	}else
		rb_raise(rb_eNotImpError,"this function require the libacl-ruby gem!");
	return Qnil;
}

#blockdev?Boolean

Returns:

  • (Boolean)

#chardev?Boolean

Returns:

  • (Boolean)

#directory?Boolean

Returns:

  • (Boolean)

#file?Boolean

Returns:

  • (Boolean)

#inspectObject

entry.inspect -> String

returns readable string.



184
185
186
187
188
189
190
# File 'ext/entry.cpp', line 184

VALUE _inspect(VALUE self){
		VALUE array[3];
		array[0]=rb_str_new2("#<%s:%s>");
		array[1]=rb_class_of(self);
		array[2]=_get_pathname(self);
		return rb_f_sprintf(3,array);
}

#pipe?Boolean

Returns:

  • (Boolean)

#socket?Boolean

Returns:

  • (Boolean)

#sourcepathObject

entry.sourcepath -> String or nil

returns the hardlink



204
205
206
207
# File 'ext/entry.cpp', line 204

VALUE ArchiveEntry_sourcepath(VALUE self)
{
	return wrap(archive_entry_sourcepath(_self));
}

#symlink?Boolean

Returns:

  • (Boolean)