class Net::SFTP::Protocol::V01::Name

  1. lib/net/sftp/protocol/01/name.rb
Parent: V01

Represents a single named item on the remote server. This includes the name, attributes about the item, and the "longname", which is intended for use when displaying directory data, and has no specified format.

Methods

Public Class

  1. new

Public Instance

  1. attributes
  2. directory?
  3. file?
  4. longname
  5. name
  6. symlink?

Attributes

attributes [R]

The Attributes object describing this item.

longname [R]

The display-ready name of the item, possibly with other attributes.

name [R]

The name of the item on the remote server.

Public Class methods

new (name, longname, attributes)

Create a new Name object with the given name, longname, and attributes.

[show source]
# File lib/net/sftp/protocol/01/name.rb, line 17
def initialize(name, longname, attributes)
  @name, @longname, @attributes = name, longname, attributes
end

Public Instance methods

directory? ()

Returns true if the item appears to be a directory. It does this by examining the attributes. If there is insufficient information in the attributes, this will return nil, rather than a boolean.

[show source]
# File lib/net/sftp/protocol/01/name.rb, line 24
def directory?
  attributes.directory?
end
file? ()

Returns true if the item appears to be a regular file. It does this by examining the attributes. If there is insufficient information in the attributes, this will return nil, rather than a boolean.

[show source]
# File lib/net/sftp/protocol/01/name.rb, line 38
def file?
  attributes.file?
end