Class: GraphQL::Execution::FieldResult

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

Overview

This is one key-value pair in a GraphQL response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field:, value:, owner:) ⇒ FieldResult

Returns a new instance of FieldResult.



15
16
17
18
19
# File 'lib/graphql/execution/field_result.rb', line 15

def initialize(field:, value:, owner:)
  @field = field
  @owner = owner
  self.value = value
end

Instance Attribute Details

#fieldGraphQL::Field (readonly)

Returns The field which resolved this value.

Returns:



10
11
12
# File 'lib/graphql/execution/field_result.rb', line 10

def field
  @field
end

#ownerSelectionResult (readonly)

Returns The result object that this field belongs to.

Returns:



13
14
15
# File 'lib/graphql/execution/field_result.rb', line 13

def owner
  @owner
end

#valueAny, Lazy

Returns the GraphQL-ready response value, or a Lazy instance.

Returns:

  • (Any, Lazy)

    the GraphQL-ready response value, or a Lazy instance



7
8
9
# File 'lib/graphql/execution/field_result.rb', line 7

def value
  @value
end

Instance Method Details

#inspectObject



47
48
49
# File 'lib/graphql/execution/field_result.rb', line 47

def inspect
  "#<FieldResult #{value.inspect} (#{field.type})>"
end