Module: Sndacs::ObjectsExtension

Defined in:
lib/sndacs/objects_extension.rb

Instance Method Summary collapse

Instance Method Details

#build(key) ⇒ Object

Builds the object in the bucket with given key



5
6
7
# File 'lib/sndacs/objects_extension.rb', line 5

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

#destroy_allObject

Destroys all keys in the bucket



34
35
36
# File 'lib/sndacs/objects_extension.rb', line 34

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



29
30
31
# File 'lib/sndacs/objects_extension.rb', line 29

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



11
12
13
14
# File 'lib/sndacs/objects_extension.rb', line 11

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