Class: DynamoDbAttributesBuilder
- Inherits:
-
Object
- Object
- DynamoDbAttributesBuilder
- Defined in:
- lib/dynamodb_framework/dynamodb_attributes_builder.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #add(name, type) ⇒ Object
-
#initialize ⇒ DynamoDbAttributesBuilder
constructor
A new instance of DynamoDbAttributesBuilder.
Constructor Details
#initialize ⇒ DynamoDbAttributesBuilder
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
#attributes ⇒ Object (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 |