Sha256: a8f6bf380843a3455dca88f3babecf53ac0883ee337c963d8dcb1b1c8c29278c

Contents?: true

Size: 787 Bytes

Versions: 5

Compression:

Stored size: 787 Bytes

Contents

module Cas
  class RemoteCallbacks
    INITIAL_SETUP ||= {
      # Process images here and return a hash
      #
      #   {
      #     small:  small_image,
      #     medium: medium_image,
      #     big:    big_image
      #   }
      #
      # `original` should always be present. If it is not, we will merge it
      # afterwards automatically.
      uploaded_image_versions: ->(io, context) {
        {}
      },

      # Class to be called after image was saved.
      after_file_upload: ->(file) { }
    }.freeze

    @@callbacks ||= INITIAL_SETUP

    def self.reset
      @@callbacks ||= INITIAL_SETUP
    end

    def self.callbacks=(callbacks_hash)
      @@callbacks = INITIAL_SETUP.merge(callbacks_hash)
    end

    def self.callbacks
      @@callbacks
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cas-cms-1.0.0.alpha1 lib/cas/remote_callbacks.rb
cas-cms-0.1.3 lib/cas/remote_callbacks.rb
cas-cms-0.1.2 lib/cas/remote_callbacks.rb
cas-cms-0.1.1 lib/cas/remote_callbacks.rb
cas-cms-0.1.0 lib/cas/remote_callbacks.rb