Module: RuboCop::GraphQL::NodePattern

Instance Method Summary collapse

Instance Method Details

#argument?(node) ⇒ Object



22
23
24
# File 'lib/rubocop/graphql/node_pattern.rb', line 22

def_node_matcher :argument?, <<~PATTERN
  (send nil? :argument (:sym _) ...)
PATTERN

#field?(node) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rubocop/graphql/node_pattern.rb', line 26

def field?(node)
  field_definition?(node) || field_definition_with_body?(node)
end

#field_definition?(node) ⇒ Object



9
10
11
# File 'lib/rubocop/graphql/node_pattern.rb', line 9

def_node_matcher :field_definition?, <<~PATTERN
  (send nil? :field (:sym _) ...)
PATTERN

#field_definition_with_body?(node) ⇒ Object



14
15
16
17
18
19
# File 'lib/rubocop/graphql/node_pattern.rb', line 14

def_node_matcher :field_definition_with_body?, <<~PATTERN
  (block
    (send nil? :field (:sym _) ...)
    ...
  )
PATTERN