lib/dynamoid/adapter.rb in dynamoid-1.3.4 vs lib/dynamoid/adapter.rb in dynamoid-2.0.0

- old
+ new

@@ -97,17 +97,17 @@ # @param [String] table the name of the table to write the object to # @param [Array] ids to delete, can also be a string of just one id # @param [Array] range_key of the record to delete, can also be a string of just one range_key # def delete(table, ids, options = {}) - range_key = options[:range_key] #array of range keys that matches the ids passed in + range_key = options[:range_key] # array of range keys that matches the ids passed in if ids.respond_to?(:each) if range_key.respond_to?(:each) - #turn ids into array of arrays each element being hash_key, range_key - ids = ids.each_with_index.map{|id,i| [id,range_key[i]]} + # turn ids into array of arrays each element being hash_key, range_key + ids = ids.each_with_index.map{|id, i| [id, range_key[i]]} else - ids = range_key ? [[ids, range_key]] : ids + ids = range_key ? ids.map { |id| [id, range_key] } : ids end batch_delete_item(table => ids) else delete_item(table, ids, options) @@ -118,10 +118,10 @@ # # @param [String] table the name of the table to write the object to # @param [Hash] scan_hash a hash of attributes: matching records will be returned by the scan # # @since 0.2.0 - def scan(table, query, opts = {}) + def scan(table, query = {}, opts = {}) benchmark('Scan', table, query) {adapter.scan(table, query, opts)} end def create_table(table_name, key, options = {}) if !tables.include?(table_name)