Sha256: a83474e565f910a37fa4916301a1fa3a6b0624043e13994040da27b1a75e6191

Contents?: true

Size: 820 Bytes

Versions: 12

Compression:

Stored size: 820 Bytes

Contents

module Paperclip
  module Callbacks
    def self.included(base)
      base.extend(Defining)
      base.send(:include, Running)
    end

    module Defining
      def define_paperclip_callbacks(*callbacks)
        define_callbacks *[callbacks, {:terminator => "result == false"}].flatten
        callbacks.each do |callback|
          eval <<-end_callbacks
            def before_#{callback}(*args, &blk)
              set_callback(:#{callback}, :before, *args, &blk)
            end
            def after_#{callback}(*args, &blk)
              set_callback(:#{callback}, :after, *args, &blk)
            end
          end_callbacks
        end
      end
    end

    module Running
      def run_paperclip_callbacks(callback, opts = nil, &block)
        run_callbacks(callback, opts, &block)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
paperclip-3.3.1 lib/paperclip/callbacks.rb
paperclip-3.2.1 lib/paperclip/callbacks.rb
paperclip-3.3.0 lib/paperclip/callbacks.rb
paperclip-3.2.0 lib/paperclip/callbacks.rb
paperclip-3.1.4 lib/paperclip/callbacks.rb
paperclip-3.1.2 lib/paperclip/callbacks.rb
paperclip-3.1.1 lib/paperclip/callbacks.rb
paperclip-3.1.0 lib/paperclip/callbacks.rb
paperclip-3.0.4 lib/paperclip/callbacks.rb
paperclip-3.0.3 lib/paperclip/callbacks.rb
cloudfuji_paperclip-3.0.3 lib/paperclip/callbacks.rb
paperclip-3.0.2 lib/paperclip/callbacks.rb