Sha256: a94bd3c8b658f0768dba57d89afaff2b7eddb7ea7405347fc8b936247792c22a

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 Bytes

Contents

module MotionResource
  class Base
    include MotionSupport::Callbacks
    
    define_callbacks :create, :save, :update, :destroy

    [:create, :save, :update, :destroy].each do |callback|
      define_singleton_method "before_#{callback}" do |*filters, &blk|
        set_callback(callback, :before, *filters, &blk)
      end

      define_singleton_method "after_#{callback}" do |*filters, &blk|
        set_callback(callback, :after, *filters, &blk)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motion-resource-0.1.4 lib/motion-resource/callbacks.rb
motion-resource-0.1.3 lib/motion-resource/callbacks.rb
motion-resource-0.1.2 lib/motion-resource/callbacks.rb