Skip to content

Commit

Permalink
Fix params method redefined warnings (#2408)
Browse files Browse the repository at this point in the history
* Fix params method redefined warnings
Activate warnings in specs

* Add CHANGELOG.md entry

* Add CHANGELOG.md entry

* Bad entry
  • Loading branch information
ericproulx authored Jan 6, 2024
1 parent 6888ad6 commit 3a6aeac
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
--color
--format=documentation
--order=rand
--warnings
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [#2399](https://github.com/ruby-grape/grape/pull/2399): Update `rubocop` to 1.59.0, `rubocop-performance` to 1.20.1 and `rubocop-rspec` to 2.25.0 - [@ericproulx](https://github.com/ericproulx).
* [#2402](https://github.com/ruby-grape/grape/pull/2402): Grape::Deprecations will be raised when running specs - [@ericproulx](https://github.com/ericproulx).
* [#2406](https://github.com/ruby-grape/grape/pull/2406): Remove mime-types dependency in specs - [@ericproulx](https://github.com/ericproulx).
* [#2408](https://github.com/ruby-grape/grape/pull/2408): Fix params method redefined warnings - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
3 changes: 2 additions & 1 deletion lib/grape/router/greedy_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class GreedyRoute

attr_reader :index, :pattern, :options, :attributes

delegate Grape::Router::AttributeTranslator::ROUTE_ATTRIBUTES => :@attributes
# params must be handled in this class to avoid method redefined warning
delegate Grape::Router::AttributeTranslator::ROUTE_ATTRIBUTES - [:params] => :@attributes

def initialize(index:, pattern:, **options)
@index = index
Expand Down
3 changes: 2 additions & 1 deletion lib/grape/router/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Route
attr_accessor :index

def_delegators :pattern, :path, :origin
delegate Grape::Router::AttributeTranslator::ROUTE_ATTRIBUTES => :attributes
# params must be handled in this class to avoid method redefined warning
delegate Grape::Router::AttributeTranslator::ROUTE_ATTRIBUTES - [:params] => :attributes

def initialize(method, pattern, **options)
@options = options
Expand Down

0 comments on commit 3a6aeac

Please sign in to comment.