Sha256: ce51fda0432f6e8a61ebbddb541afe1818dfb5371320e05fa3f9c74ea974ea0b

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

module Graphiti
  class Runner
    attr_reader :params
    include Graphiti::Base

    def initialize(resource_class, params)
      @resource_class = resource_class
      @params = params
    end

    def jsonapi_resource
      @jsonapi_resource ||= @resource_class.new
    end

    # Typically, this is 'self' of a controller
    # We're overriding here so we can do stuff like
    #
    # Graphiti.with_context my_context, {} do
    #   Runner.new ...
    # end
    def jsonapi_context
      Graphiti.context[:object]
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
graphiti-1.0.alpha.5 lib/graphiti/runner.rb
graphiti-1.0.alpha.4 lib/graphiti/runner.rb
graphiti-1.0.alpha.1 lib/graphiti/runner.rb
graphiti-rb-1.0.alpha.1 lib/graphiti/runner.rb