Class: GraphQL::Client::RenameNodeHook

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(definitions) ⇒ RenameNodeHook

Returns a new instance of RenameNodeHook.


243
244
245
# File 'lib/graphql/client.rb', line 243

def initialize(definitions)
  @definitions = definitions
end

Instance Method Details

#rename_node(node, _parent) ⇒ Object


247
248
249
250
251
252
253
# File 'lib/graphql/client.rb', line 247

def rename_node(node, _parent)
  definition = @definitions[node.name]
  if definition
    node.extend(LazyName)
    node._definition = definition
  end
end