Module: RuboCop::GraphQL::Heredoc

Included in:
Cop::GraphQL::FieldDefinitions, Cop::GraphQL::MultipleFieldDefinitions
Defined in:
lib/rubocop/graphql/heredoc.rb

Instance Method Summary collapse

Instance Method Details

#heredoc?(node) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/rubocop/graphql/heredoc.rb', line 6

def heredoc?(node)
  (node.str_type? || node.dstr_type?) && node.heredoc?
end

#range_including_heredoc(node) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rubocop/graphql/heredoc.rb', line 10

def range_including_heredoc(node)
  last_heredoc = find_last_heredoc(node)

  range = node.source_range
  range = range.join(last_heredoc.loc.heredoc_end) if last_heredoc

  range_by_whole_lines(range)
end