module S3::BucketsExtension

Public Instance Methods

build(name) click to toggle source

Builds new bucket with given name

# File lib/s3/buckets_extension.rb, line 4
def build(name)
  Bucket.send(:new, proxy_owner, name)
end
destroy_all(force = false) click to toggle source

Destroys all buckets in the service. Doesn't destroy non-empty buckets by default, pass true to force destroy (USE WITH CARE!).

# File lib/s3/buckets_extension.rb, line 25
def destroy_all(force = false)
  proxy_target.each { |bucket| bucket.destroy(force) }
end
find(name)
Alias for: find_first
find_all() click to toggle source

Finds all buckets in the service

# File lib/s3/buckets_extension.rb, line 19
def find_all
  proxy_target
end
find_first(name) click to toggle source

Finds the bucket with given name (only those which exist and You have access to it) return nil in case Error::NoSuchBucket or Error::ForbiddenBucket

# File lib/s3/buckets_extension.rb, line 10
def find_first(name)
  bucket = build(name)
  bucket.retrieve
rescue Error::ForbiddenBucket, Error::NoSuchBucket
  nil
end
Also aliased as: find