Class: Net::FTP::MLSxEntry
- Inherits:
-
Object
- Object
- Net::FTP::MLSxEntry
- Defined in:
- lib/net/ftp.rb
Overview
MLSxEntry represents an entry in responses of MLST/MLSD. Each entry has the facts (e.g., size, last modification time, etc.) and the pathname.
Instance Attribute Summary collapse
-
#facts ⇒ Object
readonly
Returns the value of attribute facts.
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Instance Method Summary collapse
-
#appendable? ⇒ Boolean
Returns
true
if the APPE command may be applied to the file. -
#creatable? ⇒ Boolean
Returns
true
if files may be created in the directory by STOU, STOR, APPE, and RNTO. -
#deletable? ⇒ Boolean
Returns
true
if the file or directory may be deleted by DELE/RMD. -
#directory? ⇒ Boolean
Returns
true
if the entry is a directory (i.e., the value of the type fact is dir, cdir, or pdir). -
#directory_makable? ⇒ Boolean
Returns
true
if the MKD command may be used to create a new directory within the directory. -
#enterable? ⇒ Boolean
Returns
true
if the directory may be entered by CWD/CDUP. -
#file? ⇒ Boolean
Returns
true
if the entry is a file (i.e., the value of the type fact is file). -
#initialize(facts, pathname) ⇒ MLSxEntry
constructor
A new instance of MLSxEntry.
-
#listable? ⇒ Boolean
Returns
true
if the listing commands, LIST, NLST, and MLSD are applied to the directory. -
#purgeable? ⇒ Boolean
Returns
true
if the objects in the directory may be deleted, or the directory may be purged. -
#readable? ⇒ Boolean
Returns
true
if the RETR command may be applied to the file. -
#renamable? ⇒ Boolean
Returns
true
if the file or directory may be renamed by RNFR. -
#writable? ⇒ Boolean
Returns
true
if the STOR command may be applied to the file.
Constructor Details
#initialize(facts, pathname) ⇒ MLSxEntry
Returns a new instance of MLSxEntry.
960 961 962 963 |
# File 'lib/net/ftp.rb', line 960 def initialize(facts, pathname) @facts = facts @pathname = pathname end |
Instance Attribute Details
#facts ⇒ Object (readonly)
Returns the value of attribute facts.
958 959 960 |
# File 'lib/net/ftp.rb', line 958 def facts @facts end |
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
958 959 960 |
# File 'lib/net/ftp.rb', line 958 def pathname @pathname end |
Instance Method Details
#appendable? ⇒ Boolean
Returns true
if the APPE command may be applied to the file.
996 997 998 |
# File 'lib/net/ftp.rb', line 996 def appendable? return facts["perm"].include?(?a) end |
#creatable? ⇒ Boolean
Returns true
if files may be created in the directory by STOU, STOR, APPE, and RNTO.
1004 1005 1006 |
# File 'lib/net/ftp.rb', line 1004 def creatable? return facts["perm"].include?(?c) end |
#deletable? ⇒ Boolean
Returns true
if the file or directory may be deleted by DELE/RMD.
1011 1012 1013 |
# File 'lib/net/ftp.rb', line 1011 def deletable? return facts["perm"].include?(?d) end |
#directory? ⇒ Boolean
Returns true
if the entry is a directory (i.e., the value of the type fact is dir, cdir, or pdir).
985 986 987 988 989 990 991 |
# File 'lib/net/ftp.rb', line 985 def directory? if /\A[cp]?dir\z/.match(facts["type"]) return true else return false end end |
#directory_makable? ⇒ Boolean
Returns true
if the MKD command may be used to create a new directory within the directory.
1041 1042 1043 |
# File 'lib/net/ftp.rb', line 1041 def directory_makable? return facts["perm"].include?(?m) end |
#enterable? ⇒ Boolean
Returns true
if the directory may be entered by CWD/CDUP.
1018 1019 1020 |
# File 'lib/net/ftp.rb', line 1018 def enterable? return facts["perm"].include?(?e) end |
#file? ⇒ Boolean
Returns true
if the entry is a file (i.e., the value of the type fact is file).
977 978 979 |
# File 'lib/net/ftp.rb', line 977 def file? return facts["type"] == "file" end |
#listable? ⇒ Boolean
Returns true
if the listing commands, LIST, NLST, and MLSD are applied to the directory.
1033 1034 1035 |
# File 'lib/net/ftp.rb', line 1033 def listable? return facts["perm"].include?(?l) end |
#purgeable? ⇒ Boolean
Returns true
if the objects in the directory may be deleted, or the directory may be purged.
1049 1050 1051 |
# File 'lib/net/ftp.rb', line 1049 def purgeable? return facts["perm"].include?(?p) end |
#readable? ⇒ Boolean
Returns true
if the RETR command may be applied to the file.
1056 1057 1058 |
# File 'lib/net/ftp.rb', line 1056 def readable? return facts["perm"].include?(?r) end |
#renamable? ⇒ Boolean
Returns true
if the file or directory may be renamed by RNFR.
1025 1026 1027 |
# File 'lib/net/ftp.rb', line 1025 def renamable? return facts["perm"].include?(?f) end |
#writable? ⇒ Boolean
Returns true
if the STOR command may be applied to the file.
1063 1064 1065 |
# File 'lib/net/ftp.rb', line 1063 def writable? return facts["perm"].include?(?w) end |