class ElFinderFtp::FtpPathname
Attributes
adapter[R]
Public Class Methods
new(adapter, list_entry_or_name, attrs = {})
click to toggle source
Calls superclass method
# File lib/el_finder_ftp/ftp_pathname.rb, line 5 def initialize(adapter, list_entry_or_name, attrs = {}) @adapter = adapter if list_entry_or_name.is_a? ElFinderFtp::FtpPathname super(list_entry_or_name.to_s) self.attrs = list_entry_or_name.attrs elsif list_entry_or_name.is_a? Net::FTP::List::Entry super(list_entry_or_name.basename) if list_entry_or_name.dir? @size = 0 @type = :directory else @type = :file @size = list_entry_or_name.filesize end @time = list_entry_or_name.mtime else super(list_entry_or_name) self.attrs = attrs end end
Public Instance Methods
+(other)
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 29 def +(other) other = FtpPathname.new(adapter, other) unless FtpPathname === other FtpPathname.new(adapter, plus(@path, other.to_s), other.attrs) end
atime()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 47 def atime mtime end
attrs()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 34 def attrs { type: @type, time: @time, size: @size } end
attrs=(val)
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 41 def attrs=(val) @time = val[:time] @type = val[:type] @size = val[:size] end
cleanpath()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 59 def cleanpath self end
ctime()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 51 def ctime mtime end
directory?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 67 def directory? type == :directory end
executable?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 136 def executable? false end
exist?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 63 def exist? adapter.exist?( self ) end
file?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 83 def file? type == :file end
ftype()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 91 def ftype type.to_s end
mkdir()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 113 def mkdir adapter.mkdir(self) @type = :directory @size = 0 end
mtime()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 55 def mtime @time ||= adapter.mtime(self) end
pipe?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 140 def pipe? false end
read()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 127 def read adapter.retrieve(self) end
readable?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 71 def readable? true end
realpath()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 87 def realpath self end
rename(to)
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 109 def rename(to) adapter.rename(self, to) end
rmdir()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 119 def rmdir adapter.rmdir(self) end
size()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 99 def size unless @type == :directory @size ||= adapter.size(self) end end
symlink?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 79 def symlink? false end
touch()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 105 def touch adapter.touch(self) end
type()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 95 def type @type ||= adapter.path_type(self) end
unlink()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 123 def unlink adapter.delete(self) end
writable?()
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 75 def writable? true end
write(content)
click to toggle source
# File lib/el_finder_ftp/ftp_pathname.rb, line 131 def write(content) adapter.store(self, content) @size = nil end