123456789_123456789_123456789_123456789_123456789_

Class: Net::FTP::MLSxEntry

Relationships & Source Files
Inherits: Object
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.

Class Method Summary

Instance Attribute Summary

Constructor Details

.new(facts, pathname) ⇒ MLSxEntry

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 950

def initialize(facts, pathname)
  @facts = facts
  @pathname = pathname
end

Instance Attribute Details

#appendable?Boolean (readonly)

Returns true if the APPE command may be applied to the file.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 986

def appendable?
  return facts["perm"].include?(?a)
end

#creatable?Boolean (readonly)

Returns true if files may be created in the directory by STOU, STOR, APPE, and RNTO.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 994

def creatable?
  return facts["perm"].include?(?c)
end

#deletable?Boolean (readonly)

Returns true if the file or directory may be deleted by DELE/RMD.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1001

def deletable?
  return facts["perm"].include?(?d)
end

#directory?Boolean (readonly)

Returns true if the entry is a directory (i.e., the value of the type fact is dir, cdir, or pdir).

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 975

def directory?
  if /\A[cp]?dir\z/.match(facts["type"])
    return true
  else
    return false
  end
end

#directory_makable?Boolean (readonly)

Returns true if the MKD command may be used to create a new directory within the directory.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1031

def directory_makable?
  return facts["perm"].include?(?m)
end

#enterable?Boolean (readonly)

Returns true if the directory may be entered by CWD/CDUP.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1008

def enterable?
  return facts["perm"].include?(?e)
end

#facts (readonly)

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 948

attr_reader :facts, :pathname

#file?Boolean (readonly)

Returns true if the entry is a file (i.e., the value of the type fact is file).

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 967

def file?
  return facts["type"] == "file"
end

#listable?Boolean (readonly)

Returns true if the listing commands, LIST, NLST, and MLSD are applied to the directory.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1023

def listable?
  return facts["perm"].include?(?l)
end

#pathname (readonly)

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 948

attr_reader :facts, :pathname

#purgeable?Boolean (readonly)

Returns true if the objects in the directory may be deleted, or the directory may be purged.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1039

def purgeable?
  return facts["perm"].include?(?p)
end

#readable?Boolean (readonly)

Returns true if the RETR command may be applied to the file.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1046

def readable?
  return facts["perm"].include?(?r)
end

#renamable?Boolean (readonly)

Returns true if the file or directory may be renamed by RNFR.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1015

def renamable?
  return facts["perm"].include?(?f)
end

#writable?Boolean (readonly)

Returns true if the STOR command may be applied to the file.

[ GitHub ]

  
# File 'lib/net/ftp.rb', line 1053

def writable?
  return facts["perm"].include?(?w)
end