Skip to content

Commit 061cf11

Browse files
committed
Avoid calling [] method multiple times
1 parent 3b91395 commit 061cf11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/grape/util/stackable_values.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def [](name)
1515
return @frozen_values[name] if @frozen_values.key? name
1616

1717
value = []
18-
value.concat(@inherited_values[name]) if @inherited_values[name]
19-
value.concat(@new_values[name]) if @new_values[name]
18+
value.concat(@inherited_values[name] || [])
19+
value.concat(@new_values[name] || [])
2020
value
2121
end
2222

0 commit comments

Comments
 (0)