Sha256: 3f7f08632b6a2c04fd3d264ddc04cd134eb70465c267609a3d11c0f38cd01399

Contents?: true

Size: 651 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
table_sync-6.0.4 lib/table_sync/setup/sequel.rb
table_sync-6.0.3 lib/table_sync/setup/sequel.rb
table_sync-6.0.2 lib/table_sync/setup/sequel.rb
table_sync-6.0 lib/table_sync/setup/sequel.rb