Class: RuboCop::Cop::Rails::StripHeredoc
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::StripHeredoc
- Extended by:
- AutoCorrector, TargetRubyVersion
- Defined in:
- lib/rubocop/cop/rails/strip_heredoc.rb
Overview
Enforces the use of squiggly heredoc over ‘strip_heredoc`.
Constant Summary collapse
- MSG =
'Use squiggly heredoc (`<<~`) instead of `strip_heredoc`.'
- RESTRICT_ON_SEND =
%i[strip_heredoc].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/rails/strip_heredoc.rb', line 34 def on_send(node) return unless (receiver = node.receiver) return unless receiver.str_type? || receiver.dstr_type? return unless receiver.respond_to?(:heredoc?) && receiver.heredoc? register_offense(node, receiver) end |