Class: RuboCop::Cop::Rails::RouteUnnecessaryArrayNotation
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::RouteUnnecessaryArrayNotation
- Extended by:
- AutoCorrector
- Includes:
- RouteHelper
- Defined in:
- lib/rubocop/cop/rails/route_unnecessary_array_notation.rb
Constant Summary collapse
- MSG =
'Unnecessary array notation for single element. ' \ 'Use `%<key>s: %<value>s` instead of `%<key>s: [%<value>s]`.'
Instance Method Summary collapse
Methods included from RouteHelper
#collect_routes, #collect_routes_from_file, #process_route_block, #process_route_file, #route_block?, #route_file?
Instance Method Details
#on_send(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubocop/cop/rails/route_unnecessary_array_notation.rb', line 15 def on_send(node) return unless route_file? return unless route_method?(node) node.arguments.each do |arg| next unless arg.hash_type? check_hash_pairs(arg) end end |