Class Fog::Storage::Rackspace::Mock::MockContainer
In: lib/fog/rackspace/storage.rb
Parent: Object

An in-memory container for use with Rackspace storage mocks. Includes many `objects` mapped by (escaped) object name. Tracks container metadata.

Methods

Attributes

meta  [R] 
objects  [R] 
service  [R] 

Public Class methods

Create a new container. Generally, you should call {Fog::Rackspace::Storage#add_container} instead.

Public Instance methods

Add a new MockObject to this container. An existing object with the same name will be overwritten.

@param name [String] The object‘s name, unescaped. @param data [String, read] The contents of the object.

Total sizes of all objects added to this container.

@return [Integer] The number of bytes occupied by each contained

  object.

Determine if this container contains any MockObjects or not.

@return [Boolean]

Access a MockObject within this container by (unescaped) name.

@return [MockObject, nil] Return the MockObject at this name if

  one exists; otherwise, `nil`.

Access a MockObject with a specific name, raising a `Fog::Storage::Rackspace::NotFound` exception if none are present.

@param name [String] (Unescaped) object name. @return [MockObject] The object within this container with the

  specified name.

Remove a MockObject from the container by name. No effect if the object is not present beforehand.

@param name [String] The (unescaped) object name to remove.

Render the HTTP headers that would be associated with this container.

@return [Hash<String, String>] Any metadata supplied to this

  container, plus additional headers indicating the container's
  size.

[Validate]