Sha256: 658044637d63990dc7d434b8ea7c19df8bdc980cfccfa274dd593a645df35e6b

Contents?: true

Size: 651 Bytes

Versions: 7

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

module TableSync::Setup
  class Sequel < Base
    private

    def define_after_commit(event)
      options = options_exposed_for_block

      object_class.define_method("after_#{event}".to_sym) do
        if instance_eval(&options[:if]) && !instance_eval(&options[:unless])
          db.after_commit do
            TableSync::Publishing::Single.new(
              object_class: self.class.name,
              original_attributes: values,
              event: event,
              debounce_time: options[:debounce_time],
            ).publish_later
          end
        end

        super()
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
table_sync-6.5.1 lib/table_sync/setup/sequel.rb
table_sync-6.5.0 lib/table_sync/setup/sequel.rb
table_sync-6.4.2 lib/table_sync/setup/sequel.rb
table_sync-6.4.1 lib/table_sync/setup/sequel.rb
table_sync-6.4.0 lib/table_sync/setup/sequel.rb
table_sync-6.3.0 lib/table_sync/setup/sequel.rb
table_sync-6.1.0 lib/table_sync/setup/sequel.rb