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: nil, line: nil, col: nil) ⇒ FragmentDefinition

Returns a new instance of FragmentDefinition.



449
450
451
452
453
454
455
456
457
458
459
# File 'lib/graphql/language/nodes.rb', line 449

def initialize(name: nil, type: nil, directives: NONE, selections: NONE, filename: nil, pos: nil, source: nil, line: nil, col: nil)
  @name = name
  @type = type
  @directives = directives
  @selections = selections
  @filename  = filename
  @pos = pos
  @source = source
  @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 444

#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)



449
450
451
452
453
454
455
456
457
458
459
# File 'lib/graphql/language/nodes.rb', line 449

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

Class Method Details

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



461
462
463
# File 'lib/graphql/language/nodes.rb', line 461

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

Instance Method Details

#marshal_dumpObject



465
466
467
# File 'lib/graphql/language/nodes.rb', line 465

def marshal_dump
  [line, col, @filename, @name, @type, @directives, @selections]
end

#marshal_load(values) ⇒ Object



469
470
471
# File 'lib/graphql/language/nodes.rb', line 469

def marshal_load(values)
  @line, @col, @filename, @name, @type, @directives, @selections = values
end