module Heredoc

Common functionality for working with heredoc strings.

Constants

OPENING_DELIMITER

Public Instance Methods

on_dstr(node)
Alias for: on_str
on_heredoc(_node) click to toggle source
# File lib/rubocop/cop/mixin/heredoc.rb, line 15
def on_heredoc(_node)
  raise NotImplementedError
end
on_str(node) click to toggle source
# File lib/rubocop/cop/mixin/heredoc.rb, line 7
def on_str(node)
  return unless heredoc?(node)

  on_heredoc(node)
end
Also aliased as: on_dstr, on_xstr
on_xstr(node)
Alias for: on_str

Private Instance Methods

delimiter_string(node) click to toggle source
# File lib/rubocop/cop/mixin/heredoc.rb, line 25
def delimiter_string(node)
  node.source.match(OPENING_DELIMITER).captures.first
end
heredoc?(node) click to toggle source
# File lib/rubocop/cop/mixin/heredoc.rb, line 21
def heredoc?(node)
  node.loc.is_a?(Parser::Source::Map::Heredoc)
end