Method: Dynamoid::Indexes::Index#initialize
- Defined in:
- lib/dynamoid/indexes.rb
#initialize(attrs = {}) ⇒ Index
Returns a new instance of Index.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/dynamoid/indexes.rb', line 190 def initialize(attrs={}) unless attrs[:dynamoid_class].present? raise Dynamoid::Errors::InvalidIndex.new(':dynamoid_class is required') end @dynamoid_class = attrs[:dynamoid_class] @type = attrs[:type] @hash_key = attrs[:hash_key] @range_key = attrs[:range_key] @name = attrs[:name] || @dynamoid_class.index_name(@hash_key, @range_key) @projected_attributes = attrs[:projected_attributes] || DEFAULT_PROJECTION_TYPE @read_capacity = attrs[:read_capacity] @write_capacity = attrs[:write_capacity] raise Dynamoid::Errors::InvalidIndex.new(self) unless self.valid? end |