class AWS::DynamoDB::PrimaryKeyElement

Constants

ATTRIBUTE_TYPES

Attributes

name[R]
type[R]

Public Class Methods

from_description(description) click to toggle source
# File lib/aws/dynamo_db/primary_key_element.rb, line 32
def self.from_description(description)
  (name, type, *extra) = description.to_a.flatten

  raise(ArgumentError,
        "key element may contain only one name/type pair") unless
    extra.empty?

  raise ArgumentError, "unsupported type #{type.inspect}" unless
    ATTRIBUTE_TYPES.values.include?(type.to_sym)

  new(:name => name.to_s, :type => type)
end
new(hash) click to toggle source
# File lib/aws/dynamo_db/primary_key_element.rb, line 27
def initialize(hash)
  @name = hash[:name] || hash["AttributeName"]
  @type = hash[:type] || ATTRIBUTE_TYPES[hash["AttributeType"]]
end