Skip to content

Commit e1a14bf

Browse files
brucehsudblock
authored andcommitted
Avoid duplicated calls in StackableValue#[] (#1561)
1 parent b4858f3 commit e1a14bf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
* [#1559](https://github.com/ruby-grape/grape/pull/1559): You can once again pass `nil` to optional attributes with `values` validation set - [@ghiculescu](https://github.com/ghiculescu).
1111
* [#1562](https://github.com/ruby-grape/grape/pull/1562): Fix rainbow gem installation failure above ruby 2.3.3 on travis-ci - [@brucehsu](https://github.com/brucehsu).
12+
* [#1561](https://github.com/ruby-grape/grape/pull/1561): Fix performance issue introduced by duplicated calls in StackableValue#[] - [@brucehsu](https://github.com/brucehsu).
1213

1314
### 0.19.1 (1/9/2017)
1415

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)