Class AWS::SimpleDB::Attribute
In: lib/aws/simple_db/attribute.rb
Parent: Object

Represents a single named item attribute in SimpleDB.

Methods

<<   add   delete   each   new   put   set   values  

Included Modules

Core::Model Enumerable ConsistentReadOption PutAttributes DeleteAttributes

Attributes

item  [R]  @return [Item] The item this attribute belongs to.
name  [R]  @return [String] The name of this attribute.

Public Class methods

Public Instance methods

<<(*values)

Alias for add

Appends values to this attribute. Duplicate values are ignored by SimpleDB.

@example Adding a list of values

  attributes['colors'].add 'red', 'blue', 'green'

@example Adding an array of values

  attributes['colors'].add ['red', 'blue']

@param [String] values A list of attribute values to add. @return [nil]

Deletes this attribute or specific values from this attribute.

@example Delete the attribute and all of its values

  item.attributes['color'].delete

@example Delete specific attribute values

  item.attributes['color'].delete('red', 'blue')

@param values One ore more values to remove from this attribute.

  If values is empty, then all attribute values are deleted
  (which deletes this attribute).

@return [nil]

Yields once for each value on this attribute.

@yield [attribute_value] Yields once for each domain in the account. @yieldparam [String] attribute_value @param [Hash] options @option options [Boolean] :consistent_read (false) A consistent read

  returns values that reflects all writes that received a successful
  response prior to the read.

@return [nil]

Sets all values for this attribute, replacing current values.

@example Setting a list of values

  attributes['colors'].set 'red', 'blue', 'green'

@example Setting an array of values

  attributes['colors'].set ['red', 'blue']

@param [String] values A list of attribute values to set. @return [nil]

Returns all values for this attribute as an array of strings.

@example

  item.attributes['ratings'].values
  #=> ['5', '3', '4']

@param [Hash] options @option options [Boolean] :consistent_read (false) A consistent read

  returns values that reflects all writes that received a successful
  response prior to the read.

@return [Array<String>] An array of attribute values

Protected Instance methods

[Validate]