Sha256: b94265906c9f8c88e2793b52b83a98d9a7dcb154b9a0f9fda7b3535458413584

Contents?: true

Size: 1.8 KB

Versions: 23

Compression:

Stored size: 1.8 KB

Contents

module Paperclip
  # Paperclip processors allow you to modify attached files when they are
  # attached in any way you are able. Paperclip itself uses command-line
  # programs for its included Thumbnail processor, but custom processors
  # are not required to follow suit.
  #
  # Processors are required to be defined inside the Paperclip module and
  # are also required to be a subclass of Paperclip::Processor. There is
  # only one method you *must* implement to properly be a subclass:
  # #make, but #initialize may also be of use. Both methods accept 3
  # arguments: the file that will be operated on (which is an instance of
  # File), a hash of options that were defined in has_attached_file's
  # style hash, and the Paperclip::Attachment itself.
  #
  # All #make needs to return is an instance of File (Tempfile is
  # acceptable) which contains the results of the processing.
  #
  # See Paperclip.run for more information about using command-line
  # utilities from within Processors.
  class Processor
    attr_accessor :file, :options, :attachment

    def initialize file, options = {}, attachment = nil
      @file = file
      @options = options
      @attachment = attachment
    end

    def make
    end

    def self.make file, options = {}, attachment = nil
      new(file, options, attachment).make
    end

    # The convert method runs the convert binary with the provided arguments.
    # See Paperclip.run for the available options.
    def convert(arguments = "", local_options = {})
      Paperclip.run('convert', arguments, local_options)
    end

    # The identify method runs the identify binary with the provided arguments.
    # See Paperclip.run for the available options.
    def identify(arguments = "", local_options = {})
      Paperclip.run('identify', arguments, local_options)
    end
  end
end

Version data entries

23 entries across 21 versions & 5 rubygems

Version Path
kt-paperclip-4.4.0 lib/paperclip/processor.rb
paperclip-5.0.0 lib/paperclip/processor.rb
paperclip-4.3.7 lib/paperclip/processor.rb
paperclip_jk-5.0.0.beta2 lib/paperclip/processor.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/lib/paperclip/processor.rb
paperclip-5.0.0.beta2 lib/paperclip/processor.rb
paperclip-5.0.0.beta1 lib/paperclip/processor.rb
paperclip-4.3.6 lib/paperclip/processor.rb
paperclip-4.3.5 lib/paperclip/processor.rb
paperclip-4.3.4 lib/paperclip/processor.rb
paperclip-4.3.3 lib/paperclip/processor.rb
paperclip-4.3.2 lib/paperclip/processor.rb
paperclip-4.3.1 lib/paperclip/processor.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/processor.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/processor.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.3/lib/paperclip/processor.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.2/lib/paperclip/processor.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/processor.rb
paperclip-4.3.0 lib/paperclip/processor.rb
paperclip-4.2.4 lib/paperclip/processor.rb