module RuboCop::Cop::Heredoc
def delimiter_string(node)
def delimiter_string(node) return '' unless (match = node.source.match(OPENING_DELIMITER)) match.captures[1] end
def heredoc_type(node)
def heredoc_type(node) return '' unless (match = node.source.match(OPENING_DELIMITER)) match.captures[0] end
def indent_level(str)
def indent_level(str) indentations = str.lines.map { |line| line[/^\s*/] }.reject { |line| line.end_with?("\n") } indentations.empty? ? 0 : indentations.min_by(&:size).size end
def on_heredoc(_node)
def on_heredoc(_node) raise NotImplementedError end
def on_str(node)
def on_str(node) return unless node.heredoc? on_heredoc(node) end