Class: Net::FTP::MLSxEntry

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(facts, pathname) ⇒ MLSxEntry

Returns a new instance of MLSxEntry.



796
797
798
799
# File 'lib/net/ftp.rb', line 796

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

Instance Attribute Details

#factsObject (readonly)

Returns the value of attribute facts



794
795
796
# File 'lib/net/ftp.rb', line 794

def facts
  @facts
end

#pathnameObject (readonly)

Returns the value of attribute pathname



794
795
796
# File 'lib/net/ftp.rb', line 794

def pathname
  @pathname
end

Instance Method Details

#appendable?Boolean

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

Returns:

  • (Boolean)


832
833
834
# File 'lib/net/ftp.rb', line 832

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.

Returns:

  • (Boolean)


840
841
842
# File 'lib/net/ftp.rb', line 840

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

#deletable?Boolean

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

Returns:

  • (Boolean)


847
848
849
# File 'lib/net/ftp.rb', line 847

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).

Returns:

  • (Boolean)


821
822
823
824
825
826
827
# File 'lib/net/ftp.rb', line 821

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.

Returns:

  • (Boolean)


877
878
879
# File 'lib/net/ftp.rb', line 877

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

#enterable?Boolean

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

Returns:

  • (Boolean)


854
855
856
# File 'lib/net/ftp.rb', line 854

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).

Returns:

  • (Boolean)


813
814
815
# File 'lib/net/ftp.rb', line 813

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

#listable?Boolean

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

Returns:

  • (Boolean)


869
870
871
# File 'lib/net/ftp.rb', line 869

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.

Returns:

  • (Boolean)


885
886
887
# File 'lib/net/ftp.rb', line 885

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

#readable?Boolean

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

Returns:

  • (Boolean)


892
893
894
# File 'lib/net/ftp.rb', line 892

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

#renamable?Boolean

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

Returns:

  • (Boolean)


861
862
863
# File 'lib/net/ftp.rb', line 861

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

#writable?Boolean

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

Returns:

  • (Boolean)


899
900
901
# File 'lib/net/ftp.rb', line 899

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