class SwiftStorage::ObjectCollection

Public Instance Methods

[](name) click to toggle source

Return a particular object

@note This always return an object, regadeless of it's existence

on the server. This call do NOT contact the server.

@param name [String]

The name (sometimes named key) of the object

@return [SwiftStorage::Object]

Object with given name
# File lib/swift_storage/object_collection.rb, line 26
def [](name)
  SwiftStorage::Object.new(container, name) if name
end
all() click to toggle source

Return all objects

@note This method will return only the first 1000 objects.

@return [Array<SwiftStorage::Object>]

Objects in this collection
# File lib/swift_storage/object_collection.rb, line 11
def all
  get_objects
end
with_prefix(prefix) click to toggle source
# File lib/swift_storage/object_collection.rb, line 30
def with_prefix(prefix)
  get_objects(prefix)
end

Private Instance Methods

get_objects(prefix=nil) click to toggle source
# File lib/swift_storage/object_collection.rb, line 35
def get_objects(prefix=nil)
  get_lines(container.name, :prefix => prefix).map { |name| SwiftStorage::Object.new(container, name)}
end