Class: DynamoDbAttributesBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamodb_framework/dynamodb_attributes_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDynamoDbAttributesBuilder

Returns a new instance of DynamoDbAttributesBuilder.



4
5
6
# File 'lib/dynamodb_framework/dynamodb_attributes_builder.rb', line 4

def initialize
  @attributes = []
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



2
3
4
# File 'lib/dynamodb_framework/dynamodb_attributes_builder.rb', line 2

def attributes
  @attributes
end

Instance Method Details

#add(name, type) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dynamodb_framework/dynamodb_attributes_builder.rb', line 8

def add(name, type)
  type_symbol = :S
  if type == 'number' || type == :N
    type_symbol = :N
  elsif type == 'binary' || type == :B
    type_symbol = :B
  elsif type == 'bool' || type == 'boolean' || type == :BOOL
    type_symbol = :BOOL
  end
  @attributes.push({ :name => name, :type => type_symbol })
end