File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,13 @@ def #{key}
164
164
return @#{ key } if @#{ key }
165
165
return missing_key("Missing setting '#{ key } ' in #{ @section } ") unless has_key? '#{ key } '
166
166
value = fetch('#{ key } ')
167
- @#{ key } = value.is_a?(Hash) ? self.class.new(value, "'#{ key } ' section in #{ @section } ") : value
167
+ @#{ key } = if value.is_a?(Hash)
168
+ self.class.new(value, "'#{ key } ' section in #{ @section } ")
169
+ elsif value.is_a?(Array) && value.all?{|v| v.is_a? Hash}
170
+ value.map{|v| self.class.new(v)}
171
+ else
172
+ value
173
+ end
168
174
end
169
175
EndEval
170
176
end
Original file line number Diff line number Diff line change @@ -19,4 +19,10 @@ collides:
19
19
does : not
20
20
nested :
21
21
collides :
22
- does : not either
22
+ does : not either
23
+
24
+ array :
25
+ -
26
+ name : first
27
+ -
28
+ name : second
Original file line number Diff line number Diff line change 9
9
Settings . setting1 . setting1_child . should == "saweet"
10
10
end
11
11
12
+ it "should access settings in nested arrays" do
13
+ Settings . array . first . name . should == "first"
14
+ end
15
+
12
16
it "should access deep nested settings" do
13
17
Settings . setting1 . deep . another . should == "my value"
14
18
end
You can’t perform that action at this time.
0 commit comments