# 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
# 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