Sha256: ba8ba2cb48569a2c1c5065c640a481fbed4d1adc827bdedaf11bf19b187dd536

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

module IIFinder
  module Callbacks
    extend ActiveSupport::Concern
    include ActiveSupport::Callbacks

    included do
      define_callbacks :call
    end

    def call
      run_callbacks :call do
        super
      end

      @relation
    end

    class_methods do
      def before_call(*args, &block)
        set_callback(:call, :before, *args, &block)
      end

      def after_call(*args, &block)
        set_callback(:call, :after, *args, &block)
      end

      def around_call(*args, &block)
        set_callback(:call, :around, *args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ii_finder-2.0.1 lib/ii_finder/callbacks.rb