Sha256: ea44bbc8e08abc18e9a8f466fe96f0d123c09d01755aff0c68aec806c54bbbd5

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

module JsonapiCompliable
  class Runner
    attr_reader :params
    include JsonapiCompliable::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
    #
    # JsonapiCompliable.with_context my_context, {} do
    #   Runner.new ...
    # end
    def jsonapi_context
      JsonapiCompliable.context[:object]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jsonapi_compliable-1.0.alpha.2 lib/jsonapi_compliable/runner.rb