File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,13 @@ def #{key}
169
169
return @#{ key } if @#{ key }
170
170
return missing_key("Missing setting '#{ key } ' in #{ @section } ") unless has_key? '#{ key } '
171
171
value = fetch('#{ key } ')
172
- @#{ key } = value.is_a?(Hash) ? self.class.new(value, "'#{ key } ' section in #{ @section } ") : value
172
+ @#{ key } = if value.is_a?(Hash)
173
+ self.class.new(value, "'#{ key } ' section in #{ @section } ")
174
+ elsif value.is_a?(Array) && value.all?{|v| v.is_a? Hash}
175
+ value.map{|v| self.class.new(v)}
176
+ else
177
+ value
178
+ end
173
179
end
174
180
EndEval
175
181
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
@@ -171,4 +175,4 @@ class NoSource < Settingslogic; end
171
175
end
172
176
end
173
177
174
- end
178
+ end
You can’t perform that action at this time.
0 commit comments