Skip to content

Commit

Permalink
Fix params method redefined warnings
Browse files Browse the repository at this point in the history
Activate warnings in specs
  • Loading branch information
ericproulx committed Jan 6, 2024
1 parent 3d85058 commit d0cda67
Show file tree
Hide file tree
Showing 3 changed files with 5 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
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 d0cda67

Please sign in to comment.