Sha256: e797a341a0ccb44c6f336ed97d44bb53c6d030b8ff7aa8c5b82d3df20858243f

Contents?: true

Size: 696 Bytes

Versions: 7

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true

require 'global_registry_bindings/workers/push_entity_worker'

module GlobalRegistry #:nodoc:
  module Bindings #:nodoc:
    module Model #:nodoc:
      module PushEntity
        extend ActiveSupport::Concern

        included do
          after_commit :push_entity_to_global_registry_async, on: (global_registry_entity.push_on - %i[destroy])
        end

        def push_entity_to_global_registry_async
          return if global_registry_entity.condition?(:if)
          return unless global_registry_entity.condition?(:unless)
          ::GlobalRegistry::Bindings::Workers::PushEntityWorker.perform_async(self.class, id)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
global-registry-bindings-0.5.0 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.4.0 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.3.3 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.3.2 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.3.1 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.3.0 lib/global_registry_bindings/model/push_entity.rb
global-registry-bindings-0.2.0 lib/global_registry_bindings/model/push_entity.rb