class ElFinderS3::S3Pathname
Attributes
adapter[R]
Public Class Methods
new(adapter, list_entry_or_name, attrs = {})
click to toggle source
Calls superclass method
ElFinderS3::Pathname::new
# File lib/el_finder_s3/s3_pathname.rb, line 5 def initialize(adapter, list_entry_or_name, attrs = {}) @adapter = adapter if list_entry_or_name.is_a? ElFinderS3::S3Pathname super(list_entry_or_name.to_s) self.attrs = list_entry_or_name.attrs elsif list_entry_or_name.is_a? Aws::S3::Types::Object super(list_entry_or_name[:key]) @size = list_entry_or_name[:size] @type = :file elsif list_entry_or_name.is_a? Aws::S3::Types::CommonPrefix name = list_entry_or_name[:prefix] super(name) @size = 0 @type = :directory else super(list_entry_or_name) self.attrs = attrs end end
Public Instance Methods
+(other)
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 26 def +(other) other = S3Pathname.new(adapter, other) unless S3Pathname === other S3Pathname.new(adapter, plus(@path, other.to_s), other.attrs) end
atime()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 45 def atime mtime end
attrs()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 31 def attrs { type: @type, time: @time, size: @size } end
attrs=(val)
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 39 def attrs=(val) @time = val[:time] @type = val[:type] @size = val[:size] end
cleanpath()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 57 def cleanpath self end
ctime()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 49 def ctime mtime end
directory?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 65 def directory? type == :directory end
executable?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 138 def executable? false end
exist?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 61 def exist? adapter.exist?(self) end
file?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 81 def file? type == :file end
ftype()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 89 def ftype type.to_s end
mkdir()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 115 def mkdir adapter.mkdir(self) @type = :directory @size = 0 end
mtime()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 53 def mtime @time ||= adapter.mtime(self) end
pipe?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 162 def pipe? false end
read()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 129 def read adapter.retrieve(self) end
readable?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 69 def readable? true end
realpath()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 85 def realpath self end
rename(to)
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 111 def rename(to) adapter.rename(self, to) end
rmdir()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 121 def rmdir adapter.rmdir(self) end
size()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 101 def size unless @type == :directory @size ||= adapter.size(self) end end
symlink?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 77 def symlink? false end
to_file_prefix_s()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 156 def to_file_prefix_s result = to_prefix_s result[-1] = '' unless result[-1] != '/' result end
to_prefix_s()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 142 def to_prefix_s prefix_s = cleanpath.to_s if prefix_s == '/' return '' elsif prefix_s[0] == '/' prefix_s[0] = '' end if prefix_s[prefix_s.size-1] != '/' prefix_s = prefix_s + '/' end prefix_s end
touch()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 107 def touch adapter.touch(self) end
type()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 93 def type @type ||= adapter.path_type(self) end
type=(value)
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 97 def type=(value) @type = value end
unlink()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 125 def unlink adapter.delete(self) end
writable?()
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 73 def writable? true end
write(content)
click to toggle source
# File lib/el_finder_s3/s3_pathname.rb, line 133 def write(content) adapter.store(self, content) @size = nil end