class S3Utils::Generator

Public Class Methods

new(path) click to toggle source
# File lib/s3_utils/generator.rb, line 3
def initialize(path)
  @path = Path.new(path)
end

Public Instance Methods

bucket() click to toggle source
# File lib/s3_utils/generator.rb, line 7
def bucket
  s3.buckets[@path.bucket_name]
end
s3_object(path=nil) click to toggle source
# File lib/s3_utils/generator.rb, line 11
def s3_object(path=nil)
  base_path = @path.path_without_bucket
  dest_path = path ? File.join(base_path, path) : base_path
  bucket.objects[dest_path]
end
s3_object_collection(path=nil) click to toggle source
# File lib/s3_utils/generator.rb, line 17
def s3_object_collection(path=nil)
  base_path = @path.path_without_bucket
  bucket.objects.with_prefix(base_path)
end
tree() click to toggle source
# File lib/s3_utils/generator.rb, line 22
def tree
  bucket.as_tree(prefix: @path.path_without_bucket)
end

Private Instance Methods

s3() click to toggle source
# File lib/s3_utils/generator.rb, line 28
def s3
  ::AWS::S3.new
end