class GraphQL::Execution::Interpreter::Runtime::GraphQLResultArray
Public Class Methods
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 181 def initialize(_result_name, _result_type, _application_value, _parent_result, _is_non_null_in_parent, _selections, _is_eager, _ast_node, _graphql_arguments, graphql_field) # rubocop:disable Metrics/ParameterLists super @graphql_result_data = [] end
Calls superclass method
GraphQL::Execution::Interpreter::Runtime::GraphQLResult::new
Public Instance Methods
Source
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 224 def [](idx) (@graphql_metadata || @graphql_result_data)[idx] end
Source
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 186 def graphql_skip_at(index) # Mark this index as dead. It's tricky because some indices may already be storing # `Lazy`s. So the runtime is still holding indexes _before_ skipping, # this object has to coordinate incoming writes to account for any already-skipped indices. @skip_indices ||= [] @skip_indices << index offset_by = @skip_indices.count { |skipped_idx| skipped_idx < index} delete_at_index = index - offset_by @graphql_metadata && @graphql_metadata.delete_at(delete_at_index) @graphql_result_data.delete_at(delete_at_index) end
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 208 def set_child_result(idx, value) if @skip_indices offset_by = @skip_indices.count { |skipped_idx| skipped_idx < idx } idx -= offset_by end @graphql_result_data[idx] = value.graphql_result_data # If we encounter some part of this response that requires metadata tracking, # then create the metadata hash if necessary. It will be kept up-to-date after this. (@graphql_metadata ||= @graphql_result_data.dup)[idx] = value value end
Source
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 198 def set_leaf(idx, value) if @skip_indices offset_by = @skip_indices.count { |skipped_idx| skipped_idx < idx } idx -= offset_by end @graphql_result_data[idx] = value @graphql_metadata && @graphql_metadata[idx] = value value end
Source
# File lib/graphql/execution/interpreter/runtime/graphql_result.rb, line 220 def values (@graphql_metadata || @graphql_result_data) end