Module: Minidynamo::Model::DefinitionHelpers

Included in:
Minidynamo::Model
Defined in:
lib/minidynamo/model/definition_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#read_capacityObject



30
31
32
# File 'lib/minidynamo/model/definition_helpers.rb', line 30

def read_capacity
	@read_capacity || 10
end

#write_capacityObject



34
35
36
# File 'lib/minidynamo/model/definition_helpers.rb', line 34

def write_capacity
	@write_capacity || 10
end

Instance Method Details

#field(key, type, options = {}) ⇒ Object

TABLE STRUCTURE HELPERS



20
21
22
23
# File 'lib/minidynamo/model/definition_helpers.rb', line 20

def field key, type, options = {}
	method_name = "#{type.to_s}_attr".to_sym
	send method_name, key, options
end

#initial_througput(options = {}) ⇒ Object



25
26
27
28
# File 'lib/minidynamo/model/definition_helpers.rb', line 25

def initial_througput options = {}
	self.read_capacity = options[:read_capacity]
	self.write_capacity = options[:write_capacity]
end

#table(options = {}) ⇒ Object

attr_accessor :range_key



10
11
12
13
14
# File 'lib/minidynamo/model/definition_helpers.rb', line 10

def table options = {}
	set_shard_name options[:name]
	self.hash_key = options[:hash_key] unless options[:hash_key].nil?
	self.range_key = options[:range_key] unless options[:range_key].nil?
end