Class: Net::SFTP::Protocol::V01::Name
- Inherits:
-
Object
- Object
- Net::SFTP::Protocol::V01::Name
- Defined in:
- lib/net/sftp/protocol/01/name.rb
Overview
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.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
The Attributes object describing this item.
-
#longname ⇒ Object
readonly
The display-ready name of the item, possibly with other attributes.
-
#name ⇒ Object
readonly
The name of the item on the remote server.
Instance Method Summary collapse
-
#directory? ⇒ Boolean
Returns
true
if the item appears to be a directory. -
#file? ⇒ Boolean
Returns
true
if the item appears to be a regular file. -
#initialize(name, longname, attributes) ⇒ Name
constructor
Create a new Name object with the given name, longname, and attributes.
-
#symlink? ⇒ Boolean
Returns
true
if the item appears to be a symlink.
Constructor Details
#initialize(name, longname, attributes) ⇒ Name
Create a new Name object with the given name, longname, and attributes.
17 18 19 |
# File 'lib/net/sftp/protocol/01/name.rb', line 17 def initialize(name, longname, attributes) @name, @longname, @attributes = name, longname, attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
The Attributes object describing this item.
14 15 16 |
# File 'lib/net/sftp/protocol/01/name.rb', line 14 def attributes @attributes end |
#longname ⇒ Object (readonly)
The display-ready name of the item, possibly with other attributes.
11 12 13 |
# File 'lib/net/sftp/protocol/01/name.rb', line 11 def longname @longname end |
#name ⇒ Object (readonly)
The name of the item on the remote server.
8 9 10 |
# File 'lib/net/sftp/protocol/01/name.rb', line 8 def name @name end |
Instance Method Details
#directory? ⇒ Boolean
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.
24 25 26 |
# File 'lib/net/sftp/protocol/01/name.rb', line 24 def directory? attributes.directory? end |
#file? ⇒ Boolean
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.
38 39 40 |
# File 'lib/net/sftp/protocol/01/name.rb', line 38 def file? attributes.file? end |
#symlink? ⇒ Boolean
Returns true
if the item appears to be a symlink. It does this by examining the attributes. If there is insufficient information in the attributes, this will return nil, rather than a boolean.
31 32 33 |
# File 'lib/net/sftp/protocol/01/name.rb', line 31 def symlink? attributes.symlink? end |