Module: RuboCop::Cop::RoutesHelper

Extended by:
NodePattern::Macros
Included in:
RuboCop::Cop::Rails::MatchRoute, RuboCop::Cop::Rails::MultipleRoutePaths
Defined in:
lib/rubocop/cop/mixin/routes_helper.rb

Overview

Common functionality for cops working with routes.

Constant Summary collapse

HTTP_METHODS =
%i[get post put patch delete].freeze

Instance Method Summary collapse

Instance Method Details

#within_routes?(node) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rubocop/cop/mixin/routes_helper.rb', line 15

def within_routes?(node)
  node.each_ancestor(:block).any? { |block| routes_draw?(block.send_node) }
end