Class: S3::BucketCollection

Inherits:
Driver::Model
  • Object
show all
Includes:
Enumerable
Defined in:
lib/s3/client/model/bucket_collection.rb

Instance Method Summary collapse

Instance Method Details

#[](bucket_name) ⇒ Bucket

Examples:


bucket = client.buckets[:mybucket],
bucket = client.buckets['mybucket'],

Parameters:

  • bucket_name (String)

Returns:



17
18
19
# File 'lib/s3/client/model/bucket_collection.rb', line 17

def [] bucket_name
  bucket_named(bucket_name)
end

#create(bucket_name) ⇒ Object



5
6
7
8
# File 'lib/s3/client/model/bucket_collection.rb', line 5

def create(bucket_name)
  @api.create_bucket(bucket_name)
  bucket_named(bucket_name)
end

#eachObject



21
22
23
24
25
26
27
# File 'lib/s3/client/model/bucket_collection.rb', line 21

def each
  xml_doc = @api.buckets
  buckets = S3::Concerns::BucketsResult.new(xml_doc).buckets
  buckets.each do |bucket|
    yield bucket_named(bucket)
  end
end