Sha256: d89c50fe9d81e5341a75baec4fca5a07494c8e2ef9af44cd2ef3a27f9283a6bf
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module CarrierWave module Uploader module Callbacks setup do extlib_inheritable_accessor :_before_callbacks, :_after_callbacks end def with_callbacks(kind, *args) self.class._before_callbacks_for(kind).each { |callback| self.send(callback, *args) } yield self.class._after_callbacks_for(kind).each { |callback| self.send(callback, *args) } end module ClassMethods def _before_callbacks_for(kind) #:nodoc: self._before_callbacks ||= {} self._before_callbacks[kind] ||= [] self._before_callbacks[kind] end def _after_callbacks_for(kind) #:nodoc: self._after_callbacks ||= {} self._after_callbacks[kind] ||= [] self._after_callbacks[kind] end def before(kind, callback) _before_callbacks_for(kind) << callback end def after(kind, callback) _after_callbacks_for(kind) << callback end end # ClassMethods end # Callbacks end # Uploader end # CarrierWave
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jnicklas-carrierwave-0.3.1 | lib/carrierwave/uploader/callbacks.rb |
carrierwave-0.3.1 | lib/carrierwave/uploader/callbacks.rb |