Class: RuboCop::GraphQL::Field::Block

Inherits:
Object
  • Object
show all
Extended by:
NodePattern::Macros
Includes:
DescriptionMethod
Defined in:
lib/rubocop/graphql/field/block.rb

Constant Summary

Constants included from DescriptionMethod

DescriptionMethod::DESCRIPTION_STRING

Instance Method Summary collapse

Methods included from DescriptionMethod

#description_method_call?, #description_with_block_arg?, #find_description_method

Constructor Details

#initialize(field_node) ⇒ Block

Returns a new instance of Block.



19
20
21
# File 'lib/rubocop/graphql/field/block.rb', line 19

def initialize(field_node)
  @nodes = field_block(field_node) || []
end

Instance Method Details

#descriptionObject



23
24
25
# File 'lib/rubocop/graphql/field/block.rb', line 23

def description
  find_description_method(@nodes)
end

#field_block(node) ⇒ Object



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

def_node_matcher :field_block, <<~PATTERN
  (block
    (send nil? :field ...)
    (args ...)
    {(begin $...)|$...}
  )
PATTERN