Class: FakeAWS::S3::BucketCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/fake_aws/s3/bucket_collection.rb

Instance Method Summary collapse

Constructor Details

#initializeBucketCollection

Returns a new instance of BucketCollection.



8
9
10
11
12
# File 'lib/fake_aws/s3/bucket_collection.rb', line 8

def initialize
  @buckets = Hash.new do |h, name|
    h[name] = Bucket.new(name)
  end
end

Instance Method Details

#[](name) ⇒ Object



14
15
16
17
# File 'lib/fake_aws/s3/bucket_collection.rb', line 14

def [](name)
  name = name.to_s
  @buckets[name]
end

#create(name, options = {}) ⇒ Object



25
26
27
# File 'lib/fake_aws/s3/bucket_collection.rb', line 25

def create(name, options = {})
  @buckets[name] = Bucket.new(name, options)
end

#each(&block) ⇒ Object



21
22
23
# File 'lib/fake_aws/s3/bucket_collection.rb', line 21

def each(&block)
  @buckets.values.sort_by(&:name).each(&block)
end