1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws] generalize indexed_params to work in more cases

This commit is contained in:
geemus 2010-05-17 20:50:51 -07:00
parent e19bea576c
commit b1ba9f677a

View file

@ -6,10 +6,13 @@ require 'fog/aws/simpledb'
module Fog module Fog
module AWS module AWS
def self.indexed_param(key, values) def self.indexed_param(key, values, offset = 0)
params = {} params = {}
unless key.include?('%d')
key << '.%d'
end
[*values].each_with_index do |value, index| [*values].each_with_index do |value, index|
params["#{key}.#{index}"] = value params[format(key, index + offset)] = value
end end
params params
end end