Sha256: 43983e3b96342311563e69b38719ceda5109bcf6bd47bafb8a8a7ac152579812
Contents?: true
Size: 937 Bytes
Versions: 18
Compression:
Stored size: 937 Bytes
Contents
module JSONAPI class Operation attr_reader :resource_klass, :operation_type, :options def initialize(operation_type, resource_klass, options) @operation_type = operation_type @resource_klass = resource_klass @options = options end def process processor.process end private def processor self.class.processor_instance_for(resource_klass, operation_type, options) end class << self def processor_instance_for(resource_klass, operation_type, params) _processor_from_resource_type(resource_klass).new(resource_klass, operation_type, params) end def _processor_from_resource_type(resource_klass) processor = resource_klass.name.gsub(/Resource$/,'Processor').safe_constantize if processor.nil? processor = JSONAPI.configuration.default_processor_klass end return processor end end end end
Version data entries
18 entries across 18 versions & 1 rubygems