module RuboCop::Chef::AutocorrectHelpers
Helpers for use in autocorrection
Public Instance Methods
expression_including_heredocs(node)
click to toggle source
if the node has a heredoc as an argument you’ll only get the start of the heredoc and removing the node will result in broken ruby. This way we match the node and the entire heredoc for removal
# File lib/rubocop/chef/autocorrect_helpers.rb, line 24 def expression_including_heredocs(node) if node.arguments.last.respond_to?(:heredoc?) && node.arguments.last.heredoc? node.loc.expression.join(node.arguments.last.loc.heredoc_end) else node.loc.expression end end