Module: S3::ObjectsExtension

Defined in:
lib/s3/objects_extension.rb

Instance Method Summary collapse

Instance Method Details

#build(key) ⇒ Object

Builds the object in the bucket with given key



4
5
6
# File 'lib/s3/objects_extension.rb', line 4

def build(key)
  Object.send(:new, proxy_owner, :key => key)
end

#destroy_allObject

Destroys all keys in the bucket



33
34
35
# File 'lib/s3/objects_extension.rb', line 33

def destroy_all
  proxy_target.each { |object| object.destroy }
end

#find_all(options = {}) ⇒ Object

Finds the objects in the bucket.

Options

  • :prefix - Limits the response to keys which begin with the indicated prefix

  • :marker - Indicates where in the bucket to begin listing

  • :max_keys - The maximum number of keys you’d like to see

  • :delimiter - Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element



28
29
30
# File 'lib/s3/objects_extension.rb', line 28

def find_all(options = {})
  proxy_owner.send(:list_bucket, options)
end

#find_first(name) ⇒ Object Also known as: find

Finds first object with given name or raises the exception if not found



10
11
12
13
# File 'lib/s3/objects_extension.rb', line 10

def find_first(name)
  object = build(name)
  object.retrieve
end