Class: GraphQL::Language::Nodes::FragmentDefinition

Inherits:
AbstractNode
  • Object
show all
Defined in:
lib/graphql/language/nodes.rb

Overview

A reusable fragment, defined at document-level.

Constant Summary

Constants inherited from AbstractNode

AbstractNode::NO_CHILDREN

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#filename

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractNode

#==, #children, #children_method_name, children_of_type, #col, #definition_line, #delete_child, inherited, #initialize_copy, #line, #merge, #position, #replace_child, #scalars, #to_query_string

Constructor Details

#initialize(name: nil, type: nil, directives: NONE, selections: NONE, filename: nil, pos: nil, source_string: nil, line: nil, col: nil) ⇒ FragmentDefinition

Returns a new instance of FragmentDefinition.



423
424
425
426
427
428
429
430
431
432
433
# File 'lib/graphql/language/nodes.rb', line 423

def initialize(name: nil, type: nil, directives: NONE, selections: NONE, filename: nil, pos: nil, source_string: nil, line: nil, col: nil)
  @name = name
  @type = type
  @directives = directives
  @selections = selections
  @filename  = filename
  @pos = pos
  @source_string = source_string
  @line = line
  @col = col
end

Instance Attribute Details

#nameString

Returns the identifier for this fragment, which may be applied with ...#{name}.

Returns:

  • (String)

    the identifier for this fragment, which may be applied with ...#{name}



# File 'lib/graphql/language/nodes.rb', line 418

#typeString

Returns the type condition for this fragment (name of type which it may apply to).

Returns:

  • (String)

    the type condition for this fragment (name of type which it may apply to)



423
424
425
426
427
428
429
430
431
432
433
# File 'lib/graphql/language/nodes.rb', line 423

def initialize(name: nil, type: nil, directives: NONE, selections: NONE, filename: nil, pos: nil, source_string: nil, line: nil, col: nil)
  @name = name
  @type = type
  @directives = directives
  @selections = selections
  @filename  = filename
  @pos = pos
  @source_string = source_string
  @line = line
  @col = col
end

Class Method Details

.from_a(filename, line, col, name, type, directives, selections) ⇒ Object



435
436
437
# File 'lib/graphql/language/nodes.rb', line 435

def self.from_a(filename, line, col, name, type, directives, selections)
  self.new(filename: filename, line: line, col: col, name: name, type: type, directives: directives, selections: selections)
end