Class: S3Utils::Generator
- Inherits:
-
Object
- Object
- S3Utils::Generator
- Defined in:
- lib/s3_utils/generator.rb
Instance Method Summary collapse
- #bucket ⇒ Object
-
#initialize(path) ⇒ Generator
constructor
A new instance of Generator.
- #s3_object(path = nil) ⇒ Object
- #s3_object_collection(path = nil) ⇒ Object
- #tree ⇒ Object
Constructor Details
Instance Method Details
#bucket ⇒ Object
7 8 9 |
# File 'lib/s3_utils/generator.rb', line 7 def bucket s3.buckets[@path.bucket_name] end |
#s3_object(path = nil) ⇒ Object
11 12 13 14 15 |
# 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) ⇒ Object
17 18 19 20 |
# 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 ⇒ Object
22 23 24 |
# File 'lib/s3_utils/generator.rb', line 22 def tree bucket.as_tree(prefix: @path.path_without_bucket) end |