class GraphQL::Execution::Interpreter::Runtime::GraphQLResultArray
Public Class Methods
new(_result_name, _parent_result)
click to toggle source
Calls superclass method
GraphQL::Execution::Interpreter::Runtime::GraphQLResult::new
# File lib/graphql/execution/interpreter/runtime.rb, line 100 def initialize(_result_name, _parent_result) super @graphql_result_data = [] end
Public Instance Methods
[]=(idx, value)
click to toggle source
# File lib/graphql/execution/interpreter/runtime.rb, line 117 def []=(idx, value) if @skip_indices offset_by = @skip_indices.count { |skipped_idx| skipped_idx < idx } idx -= offset_by end if value.respond_to?(:graphql_result_data) @graphql_result_data[idx] = value.graphql_result_data (@graphql_metadata ||= @graphql_result_data.dup)[idx] = value else @graphql_result_data[idx] = value @graphql_metadata && @graphql_metadata[idx] = value end value end
graphql_skip_at(index)
click to toggle source
# File lib/graphql/execution/interpreter/runtime.rb, line 105 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
values()
click to toggle source
# File lib/graphql/execution/interpreter/runtime.rb, line 133 def values (@graphql_metadata || @graphql_result_data) end