Skip to content

Commit fa9e3a6

Browse files
committed
Use reverse_merge to set default options.
1 parent 8c2f83c commit fa9e3a6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/grape/dsl/inside_route.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ module InsideRoute
1616
# options. `:include_parent_namespaces` defaults to true, hence must be set to false if
1717
# you want only to return params declared against the current/target endpoint.
1818
def declared(params, options = {}, declared_params = nil)
19-
options[:include_missing] = true unless options.key?(:include_missing)
20-
options[:include_parent_namespaces] = true unless options.key?(:include_parent_namespaces)
19+
options.reverse_merge!(include_missing: true, include_parent_namespaces: true)
2120

2221
declared_params ||= (!options[:include_parent_namespaces] ? route_setting(:declared_params) : (route_setting(:saved_declared_params) || [])).flatten(1) || []
2322

0 commit comments

Comments
 (0)