Sha256: e533f180094a4c92ddac7ef79d3e61af731512f07398147d2992a8621fc78ad5

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

# frozen-string_literal: true

module TableSync::Setup
  class ActiveRecord < Base
    private

    def define_after_commit(event)
      options = options_exposed_for_block

      object_class.after_commit(on: event) do
        if instance_eval(&options[:if]) && !instance_eval(&options[:unless])
          TableSync::Publishing::Single.new(
            object_class: self.class.name,
            original_attributes: attributes,
            event: event,
            debounce_time: options[:debounce_time],
          ).publish_later
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
table_sync-6.0 lib/table_sync/setup/active_record.rb