Class: SFML::FtpListingResponse
- Inherits:
-
Object
- Object
- SFML::FtpListingResponse
- Defined in:
- ext/network/ftp.c,
ext/network/ftp.c
Overview
An FtpResponse specialization returned by Ftp#directory_listing, additionally carrying the list of filenames.
Instance Method Summary collapse
-
#count ⇒ Integer
Returns the number of filenames in the listing.
-
#message ⇒ String
Returns the message sent by the server.
-
#name(index) ⇒ String
Returns the filename stored at
indexin the listing. -
#ok? ⇒ Boolean
Returns
trueif the server reported success. -
#status ⇒ Integer
Returns the raw status code reported by the server.
-
#status_name ⇒ Symbol
Returns the status as an FtpStatus name.
Instance Method Details
#count ⇒ Integer
Returns the number of filenames in the listing.
546 547 548 |
# File 'ext/network/ftp.c', line 546 static VALUE FtpListingResponse_count(VALUE self) { return SIZET2NUM(sfFtpListingResponse_getCount(Get_FtpListingResponse_Struct(self))); } |
#message ⇒ String
Returns the message sent by the server.
536 537 538 |
# File 'ext/network/ftp.c', line 536 static VALUE FtpListingResponse_message(VALUE self) { return rb_str_new_cstr(sfFtpListingResponse_getMessage(Get_FtpListingResponse_Struct(self))); } |
#name(index) ⇒ String
Returns the filename stored at index in the listing.
558 559 560 561 562 563 564 565 566 567 568 |
# File 'ext/network/ftp.c', line 558
static VALUE FtpListingResponse_name(VALUE self, VALUE rb_index) {
void* response = Get_FtpListingResponse_Struct(self);
size_t index = (size_t)NUM2SIZET(rb_index);
size_t count = sfFtpListingResponse_getCount(response);
if (index >= count) {
rb_raise(rb_eIndexError, "index %zu outside of listing size %zu", index, count);
}
return rb_str_new_cstr(sfFtpListingResponse_getName(response, index));
}
|
#ok? ⇒ Boolean
Returns true if the server reported success.
505 506 507 |
# File 'ext/network/ftp.c', line 505 static VALUE FtpListingResponse_ok(VALUE self) { return BOOL2RB(sfFtpListingResponse_isOk(Get_FtpListingResponse_Struct(self))); } |
#status ⇒ Integer
Returns the raw status code reported by the server.
515 516 517 |
# File 'ext/network/ftp.c', line 515 static VALUE FtpListingResponse_status(VALUE self) { return INT2NUM(sfFtpListingResponse_getStatus(Get_FtpListingResponse_Struct(self))); } |
#status_name ⇒ Symbol
Returns the status as an FtpStatus name.
525 526 527 528 |
# File 'ext/network/ftp.c', line 525 static VALUE FtpListingResponse_status_name(VALUE self) { return ID2SYM(rb_intern( ftp_status_name(sfFtpListingResponse_getStatus(Get_FtpListingResponse_Struct(self))))); } |