Class: RuboCop::Cop::GitHub::RailsControllerRenderActionSymbol

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/github/rails_controller_render_action_symbol.rb

Constant Summary collapse

MSG =
"Prefer `render` with string instead of symbol"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rubocop/cop/github/rails_controller_render_action_symbol.rb', line 25

def on_send(node)
  if sym_node = render_sym?(node)
    add_offense(sym_node) do |corrector|
      register_offense(sym_node, node)
    end
  elsif option_pairs = render_with_options?(node)
    option_pairs.each do |pair|
      if sym_node = action_key?(pair)
        register_offense(sym_node, node)
      end
    end
  end
end