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.

Instance Attribute Summary collapse

Attributes inherited from AbstractNode

#col, #filename, #line

Instance Method Summary collapse

Methods inherited from AbstractNode

#eql?, #initialize, #position, #to_query_string

Constructor Details

This class inherits a constructor from GraphQL::Language::Nodes::AbstractNode

Instance Attribute Details

#directivesObject

Returns the value of attribute directives



213
214
215
# File 'lib/graphql/language/nodes.rb', line 213

def directives
  @directives
end

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



215
216
217
# File 'lib/graphql/language/nodes.rb', line 215

def name
  @name
end

#selectionsObject

Returns the value of attribute selections



213
214
215
# File 'lib/graphql/language/nodes.rb', line 213

def selections
  @selections
end

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



220
221
222
# File 'lib/graphql/language/nodes.rb', line 220

def type
  @type
end

Instance Method Details

#childrenObject



227
228
229
# File 'lib/graphql/language/nodes.rb', line 227

def children
  directives + selections
end

#initialize_node(name: nil, type: nil, directives: [], selections: []) ⇒ Object



220
221
222
223
224
225
# File 'lib/graphql/language/nodes.rb', line 220

def initialize_node(name: nil, type: nil, directives: [], selections: [])
  @name = name
  @type = type
  @directives = directives
  @selections = selections
end

#scalarsObject



231
232
233
# File 'lib/graphql/language/nodes.rb', line 231

def scalars
  [name, type]
end