Class: RuboCop::Cop::StimulusReflex::CableReadyBroadcaster

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/stimulus_reflex/cable_ready_broadcaster.rb

Constant Summary collapse

MSG =
"You don't need to include `CableReady::Broadcaster` inside your reflex. You can use the `cable_ready`" \
" accessor without the need to include the module."

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

#on_send(node) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rubocop/cop/stimulus_reflex/cable_ready_broadcaster.rb', line 10

def on_send(node)
  return unless node.method_name == :include

  broadcaster = node.arguments.find { |c| c.const_name == "CableReady::Broadcaster" }

  add_offense(broadcaster) if broadcaster
end