Sha256: 364a7d9d73720721fde5707b67980cc499a63dbe904c726930f2f1c30d0b2e34

Contents?: true

Size: 917 Bytes

Versions: 14

Compression:

Stored size: 917 Bytes

Contents

# frozen_string_literal: true
require 'active_model/callbacks'

module ActiveEncode
  # = Active Encode Callbacks
  #
  # Active Encode provides hooks during the life cycle of an encode. Callbacks allow you
  # to trigger logic during the life cycle of an encode. Available callbacks are:
  #
  # * <tt>after_find</tt>
  # * <tt>after_reload</tt>
  # * <tt>before_create</tt>
  # * <tt>around_create</tt>
  # * <tt>after_create</tt>
  # * <tt>before_cancel</tt>
  # * <tt>around_cancel</tt>
  # * <tt>after_cancel</tt>
  #
  module Callbacks
    extend ActiveSupport::Concern

    CALLBACKS = [
      :after_find, :after_reload, :before_create, :around_create,
      :after_create, :before_cancel, :around_cancel, :after_cancel
    ].freeze

    included do
      extend ActiveModel::Callbacks

      define_model_callbacks :find, :reload, only: :after
      define_model_callbacks :create, :cancel
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_encode-1.2.3 lib/active_encode/callbacks.rb
active_encode-1.2.2 lib/active_encode/callbacks.rb
active_encode-1.2.1 lib/active_encode/callbacks.rb
active_encode-1.2.0 lib/active_encode/callbacks.rb
active_encode-1.1.3 lib/active_encode/callbacks.rb
active_encode-1.1.2 lib/active_encode/callbacks.rb
active_encode-1.1.1 lib/active_encode/callbacks.rb
active_encode-1.1.0 lib/active_encode/callbacks.rb
active_encode-1.0.0 lib/active_encode/callbacks.rb
active_encode-0.8.2 lib/active_encode/callbacks.rb
active_encode-0.8.1 lib/active_encode/callbacks.rb
active_encode-0.8.0 lib/active_encode/callbacks.rb
active_encode-0.7.0 lib/active_encode/callbacks.rb
active_encode-0.6.0 lib/active_encode/callbacks.rb