lib/stashify/directory/aws/s3.rb in stashify-aws-s3-1.0.0 vs lib/stashify/directory/aws/s3.rb in stashify-aws-s3-1.1.0

- old
+ new

@@ -12,36 +12,41 @@ def initialize(bucket:, path:) @bucket = bucket super(path: path) end + def parent + Stashify::Directory::AWS::S3.new( + bucket: @bucket, + path: ::File.dirname(path), + ) + end + def files @bucket.objects.map do |object| key = object.key file(::File.basename(key)) if key =~ %r{^#{Regexp.escape(path)}/([^/]*)(/.*)?$} end.compact end - def ==(other) - self.class == other.class && @bucket == other.bucket && path == other.path - end - - private - def directory?(name) @bucket.objects(prefix: path_of(name, "")).count.positive? end def directory(name) Stashify::Directory::AWS::S3.new(bucket: @bucket, path: path_of(name)) end - def file?(name) + def exists?(name) @bucket.object(::File.join(path, name)).exists? end def file(name) Stashify::File::AWS::S3.new(bucket: @bucket, path: ::File.join(path, name)) + end + + def ==(other) + self.class == other.class && @bucket == other.bucket && path == other.path end end end end end