Sha256: b4b5d3f20951b952d332f1b13a26836883256299af6777ca1c579ddd10409a8a

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

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

  def initialize(operation_definition, query)
    @operation_definition = operation_definition
    @variables = query.params
    @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

2 entries across 2 versions & 1 rubygems

Version Path
graphql-0.5.0 lib/graph_ql/query/operation_resolver.rb
graphql-0.4.0 lib/graph_ql/query/operation_resolver.rb