class Net::FTP::List::Entry

Represents an entry of the FTP list. Gets returned when you parse a list.

Attributes

basename[R]
filesize[R]
mtime[R]
name[R]
raw[R]
server_type[R]
size[R]
to_s[R]
type[R]

Public Instance Methods

<=>(other) click to toggle source

Compares the receiver against another object.

@param (see eql?)

@return [Integer] -1, 0, or +1 depending on whether the receiver is less than, equal to, or greater than the other object.

# File lib/net/ftp/list/entry.rb, line 48
def <=>(other)
  case other
  when ::Net::FTP::List::Entry
    return filesize <=> other.filesize
  when Numeric
    return filesize <=> other
  end

  raise ArgumentError, format('comparison of %<self>s with %<other>s failed!', self: self.class, other: other.class)
end
device?() click to toggle source

Looks like a device.

# File lib/net/ftp/list/entry.rb, line 76
def device?
  type == :device
end
dir?() click to toggle source

Looks like a directory, try CWD.

# File lib/net/ftp/list/entry.rb, line 60
def dir?
  type == :dir
end
Also aliased as: directory?
directory?()
Alias for: dir?
eql?(other) click to toggle source

Tests for objects equality (value and type).

@param entry [Net::FTP::List::Entry] an entry of the FTP list.

@return [true, false] true if the objects are equal and have the same type; false otherwise.

# File lib/net/ftp/list/entry.rb, line 35
def eql?(other)
  return false unless other.is_a?(::Net::FTP::List::Entry)
  return true if equal?(other)

  raw == other.raw # if it's exactly the same line then the objects are the same
end
file?() click to toggle source

Looks like a file, try RETR.

# File lib/net/ftp/list/entry.rb, line 66
def file?
  type == :file
end
unknown?() click to toggle source

Is the entry type unknown?

# File lib/net/ftp/list/entry.rb, line 81
def unknown?
  !dir? && !file? && !symlink? && !device?
end