Sha256: 3df3d3e3a66975dc6d28739e2d28a25d4b986af75bcea41a2caefe87ec1cb075

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'much-plugin'

require 'mr/after_commit/fake_record'
require 'mr/after_commit/record'
require 'mr/after_commit/record_procs_methods'
require 'mr/model'

module MR

  module AfterCommit
    include MuchPlugin

    # demeter these constants so they are available from the `MR::AfterCommit`
    # namespace
    VALID_CALLBACK_TYPES  = RecordProcsMethods::VALID_CALLBACK_TYPES
    DEFAULT_CALLBACK_TYPE = RecordProcsMethods::DEFAULT_CALLBACK_TYPE

    plugin_included do
      include MR::Model
      include InstanceMethods
    end

    module InstanceMethods

      def after_commit_procs(*args)
        self.record.after_commit_procs(*args)
      end

      def after_commit(on = nil, &block)
        self.record.add_after_commit_proc(on, &block)
      end

      def prepend_after_commit(on = nil, &block)
        self.record.prepend_after_commit_proc(on, &block)
      end

      def clear_after_commit_procs(*args)
        self.record.clear_after_commit_procs(*args)
      end

      def called_after_commit_procs(*args)
        self.record.called_after_commit_procs(*args)
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mr-0.35.2 lib/mr/after_commit.rb