Sha256: 76e80372b80087528fd1d039027549f4f7e8bc6ee9cccba133de5a070910d858

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

module IIFinder
  module Coactors
    extend ActiveSupport::Concern

    included do
      include Coactive::Base

      configure_coactive do |config|
        config.load_paths = ['app/finders']
        config.class_suffix = 'Finder'
        config.use_cache = true
        config.lookup_superclass_until = ['ActiveRecord::Base', 'ActiveModel::Base']
      end

      class << self
        alias_method :chain, :coact
      end
    end

    def call
      coactors.each do |finder|
        merge_relation!(finder.call(*@_args))
      end
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ii_finder-2.0.1 lib/ii_finder/coactors.rb
ii_finder-2.0.0 lib/ii_finder/coactors.rb