lib/paperclip/callbacks.rb in paperclip-4.3.7 vs lib/paperclip/callbacks.rb in paperclip-5.0.0.beta1

- old
+ new

@@ -5,11 +5,11 @@ base.send(:include, Running) end module Defining def define_paperclip_callbacks(*callbacks) - define_callbacks(*[callbacks, {:terminator => callback_terminator}].flatten) + define_callbacks(*[callbacks, { terminator: hasta_la_vista_baby }].flatten) callbacks.each do |callback| eval <<-end_callbacks def before_#{callback}(*args, &blk) set_callback(:#{callback}, :before, *args, &blk) end @@ -20,14 +20,16 @@ end end private - def callback_terminator - if ::ActiveSupport::VERSION::STRING >= '4.1' - lambda { |target, result| result == false } - else - 'result == false' + def hasta_la_vista_baby + lambda do |_, result| + if result.respond_to?(:call) + result.call == false + else + result == false + end end end end module Running