Class: GraphQL::Language::Document

Inherits:
Struct
  • Object
show all
Defined in:
lib/graphql/language/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#definitionsObject

Returns the value of attribute definitions

Returns:

  • (Object)

    the current value of definitions



3
4
5
# File 'lib/graphql/language/document.rb', line 3

def definitions
  @definitions
end

Instance Method Details

#fragment(name) ⇒ Object



17
18
19
# File 'lib/graphql/language/document.rb', line 17

def fragment(name)
  fragments.find { |fragment| fragment.name == name }
end

#fragmentsObject



13
14
15
# File 'lib/graphql/language/document.rb', line 13

def fragments
  @fragments ||= definitions.select { |definition| definition.is_a?(FragmentDefinition) }
end

#operation(name) ⇒ Object



9
10
11
# File 'lib/graphql/language/document.rb', line 9

def operation(name)
  operations.find { |operation| operation.name == name }
end

#operationsObject



5
6
7
# File 'lib/graphql/language/document.rb', line 5

def operations
  @operations ||= definitions.select { |definition| definition.is_a?(OperationDefinition) }
end