Sha256: 23d42a665a58a2d1abff0ad33306c20e33e676f5f64ce702dc7e6fd28d94e100

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

class GraphQL::Query::OperationResolver
  attr_reader :variables, :query, :context

  def initialize(operation_definition, query)
    @operation_definition = operation_definition
    @variables = query.variables
    @query = query
    @context = query.context
  end

  def result
    @result ||= execute(@operation_definition, query)
  end

  private

  def execute(op_def, query)
    root = if op_def.operation_type == "query"
      query.schema.query
    elsif op_def.operation_type == "mutation"
      query.schema.mutation
    end
    resolver = GraphQL::Query::SelectionResolver.new(nil, root, op_def.selections, self)
    resolver.result
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
graphql-0.6.2 lib/graphql/query/operation_resolver.rb
graphql-0.6.1 lib/graphql/query/operation_resolver.rb
graphql-0.6.0 lib/graphql/query/operation_resolver.rb