Class: GraphQL::Modernize::Rules::FunctionSuperclass

Inherits:
Base
  • Object
show all
Defined in:
lib/graphql/modernize/rules/legacy.rb

Instance Attribute Summary

Attributes inherited from Base

#offenses

Instance Method Summary collapse

Methods inherited from Base

#initialize, node_pattern, node_types, rule, #visit

Constructor Details

This class inherits a constructor from GraphQL::Modernize::Rules::Base

Instance Method Details

#on_match(node, _captures) ⇒ Object



154
155
156
157
158
159
160
# File 'lib/graphql/modernize/rules/legacy.rb', line 154

def on_match(node, _captures)
  return unless constant_source(node.superclass) == "GraphQL::Function"

  add_offense(node.superclass.location, message: "Migrate `GraphQL::Function` to Resolver") do |rw|
    replace_constant(rw, node.superclass, "GraphQL::Schema::Resolver")
  end
end