Skip to content

Commit

Permalink
Fix rubocop ClassLength
Browse files Browse the repository at this point in the history
Add CHANGELOG.md
  • Loading branch information
ericproulx committed Jun 25, 2024
1 parent 6722b3c commit 1f3c8dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

* [#2459](https://github.com/ruby-grape/grape/pull/2459): Autocorrect cops - [@ericproulx](https://github.com/ericproulx).
* [#3458](https://github.com/ruby-grape/grape/pull/2458): Remove unused Grape::Util::Accept::Header - [@ericproulx](https://github.com/ericproulx).
* [#2463](https://github.com/ruby-grape/grape/pull/2463): Fix error message indices - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

### 2.1.1 (2024-06-22)
Expand Down
10 changes: 1 addition & 9 deletions lib/grape/validations/params_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,14 @@ def should_validate?(parameters)

def meets_dependency?(params, request_params)
return true unless @dependent_on

return false if @parent.present? && !@parent.meets_dependency?(@parent.params(request_params), request_params)

return params.any? { |param| meets_dependency?(param, request_params) } if params.is_a?(Array)

meets_hash_dependency?(params)
end

def attr_meets_dependency?(params)
return true unless @dependent_on

return false if @parent.present? && !@parent.attr_meets_dependency?(params)

meets_hash_dependency?(params)
Expand Down Expand Up @@ -301,12 +298,7 @@ def new_lateral_scope(options, &block)
# `optional` invocation that opened this scope.
# @yield parameter scope
def new_group_scope(attrs, &block)
self.class.new(
api: @api,
parent: self,
group: attrs.first,
&block
)
self.class.new(api: @api, parent: self, group: attrs.first, &block)
end

# Pushes declared params to parent or settings
Expand Down

0 comments on commit 1f3c8dc

Please sign in to comment.