Module | Paperclip

In:

vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb
vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb
vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb
vendor/plugins/paperclip/lib/paperclip/geometry.rb
vendor/plugins/paperclip/lib/paperclip/storage.rb
vendor/plugins/paperclip/lib/paperclip/upfile.rb
vendor/plugins/paperclip/lib/paperclip/attachment.rb
vendor/plugins/paperclip/lib/paperclip/processor.rb
vendor/plugins/paperclip/lib/paperclip/thumbnail.rb
vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb
vendor/plugins/paperclip/lib/paperclip.rb

The base module that gets included in ActiveRecord::Base. See the documentation for Paperclip::ClassMethods for more useful information.

### Methods

interpolates options run

### Classes and Modules

Module Paperclip::CallbackCompatability
Module Paperclip::ClassMethods
Module Paperclip::Shoulda
Module Paperclip::Storage
Module Paperclip::Upfile
Class Paperclip::Attachment
Class Paperclip::Geometry
Class Paperclip::Processor
Class Paperclip::Tempfile
Class Paperclip::Thumbnail

### Constants

VERSION | = | "2.2.6"

### Public Class methods

interpolates(key, &block)

[Source]

        # File vendor/plugins/paperclip/lib/paperclip.rb, line 76
    76:     def interpolates key, &block
    77:       Paperclip::Attachment.interpolations[key] = block
    78:     end

options()

Provides configurability to Paperclip. There are a number of options available, such as:

- whiny_thumbnails: Will raise an error if Paperclip cannot process thumbnails of an uploaded image. Defaults to true.
- log: Logs progress to the Rails log. Uses ActiveRecord‘s logger, so honors log levels, etc. Defaults to true.
- command_path: Defines the path at which to find the command line programs if they are not visible to Rails the system‘s search path. Defaults to nil, which uses the first executable found in the user‘s search path.
- image_magick_path: Deprecated alias of command_path.

[Source]

        # File vendor/plugins/paperclip/lib/paperclip.rb, line 58
    58:     def options
    59:       @options ||= {
    60:         :whiny_thumbnails  => true,
    61:         :image_magick_path => nil,
    62:         :command_path      => nil,
    63:         :log               => true,
    64:         :swallow_stderr    => true
    65:       }
    66:     end

run(cmd, params = "", expected_outcodes = 0)

The run method takes a command to execute and a string of parameters that get passed to it. The command is prefixed with the :command_path option from Paperclip.options. If you have many commands to run and they are in different paths, the suggested course of action is to symlink them so they are all in the same directory.

If the command returns with a result code that is not one of the expected_outcodes, a PaperclipCommandLineError will be raised. Generally a code of 0 is expected, but a list of codes may be passed if necessary.

[Source]

        # File vendor/plugins/paperclip/lib/paperclip.rb, line 89
    89:     def run cmd, params = "", expected_outcodes = 0
    90:       command = %Q<#{%Q[#{path_for_command(cmd)} #{params}].gsub(/\s+/, " ")}>
    91:       command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr]
    92:       output = `#{command}`
    93:       unless [expected_outcodes].flatten.include?($?.exitstatus)
    94:         raise PaperclipCommandLineError, "Error while running #{cmd}"
    95:       end
    96:       output
    97:     end

[Validate]