swirl 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,8 @@ module Swirl
44
44
  when Array
45
45
  key = "#{key}.#" if key !~ /#/
46
46
  value.each_with_index do |val, n|
47
- exp[key.gsub("#", n.to_s)] = val
47
+ # We must use n+1 because some api's do not allow a 0 index
48
+ exp[key.gsub("#", (n+1).to_s)] = val
48
49
  end
49
50
  when Range
50
51
  exp["From#{key}"] = value.min
@@ -21,9 +21,9 @@ class ExpanderTest < Test::Unit::TestCase
21
21
  request = { "group" => ["foo", "bar", "baz"] }
22
22
 
23
23
  expected = {
24
- "group.0" => "foo",
25
- "group.1" => "bar",
26
- "group.2" => "baz"
24
+ "group.1" => "foo",
25
+ "group.2" => "bar",
26
+ "group.3" => "baz"
27
27
  }
28
28
 
29
29
  assert_equal expected, Expander.expand(request)
@@ -33,9 +33,9 @@ class ExpanderTest < Test::Unit::TestCase
33
33
  request = { "foo.#.bar" => ["foo", "bar", "baz"] }
34
34
 
35
35
  expected = {
36
- "foo.0.bar" => "foo",
37
- "foo.1.bar" => "bar",
38
- "foo.2.bar" => "baz"
36
+ "foo.1.bar" => "foo",
37
+ "foo.2.bar" => "bar",
38
+ "foo.3.bar" => "baz"
39
39
  }
40
40
 
41
41
  assert_equal expected, Expander.expand(request)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swirl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
- - 1
10
- version: 1.7.1
9
+ - 2
10
+ version: 1.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Mizerany