swirl 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/swirl/helpers.rb +2 -1
- data/test/expander_test.rb +6 -6
- metadata +3 -3
data/lib/swirl/helpers.rb
CHANGED
@@ -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
|
-
|
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
|
data/test/expander_test.rb
CHANGED
@@ -21,9 +21,9 @@ class ExpanderTest < Test::Unit::TestCase
|
|
21
21
|
request = { "group" => ["foo", "bar", "baz"] }
|
22
22
|
|
23
23
|
expected = {
|
24
|
-
"group.
|
25
|
-
"group.
|
26
|
-
"group.
|
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.
|
37
|
-
"foo.
|
38
|
-
"foo.
|
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