Class: FakeAWS::S3::BucketCollection
- Inherits:
-
Object
- Object
- FakeAWS::S3::BucketCollection
- Includes:
- Enumerable
- Defined in:
- lib/fake_aws/s3/bucket_collection.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #create(name, options = {}) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ BucketCollection
constructor
A new instance of BucketCollection.
Constructor Details
#initialize ⇒ BucketCollection
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, = {}) @buckets[name] = Bucket.new(name, ) 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 |