module MiniMagick::Configuration
Constants
- CLI_DETECTION
Attributes
Set whether you want to use [ImageMagick](www.imagemagick.org) or [GraphicsMagick](www.graphicsmagick.org).
@return [Symbol] `:imagemagick`, `:imagemagick7`, or `:graphicsmagick`
If you don't have the CLI tools in your PATH, you can set the path to the executables.
@return [String]
Adds a prefix to the CLI command. For example, you could use `firejail` to run all commands in a sandbox. Can be a string, or an array of strings. e.g. 'firejail', or ['firejail', '–force']
@return [String] @return [Array<String>]
When set to `true`, it outputs each command to STDOUT in their shell version.
@return [Boolean]
Logger for {#debug}, default is `MiniMagick::Logger.new(STDOUT)`, but you can override it, for example if you want the logs to be written to a file.
@return [Logger]
@private (for backwards compatibility)
@private (for backwards compatibility)
Instructs MiniMagick
how to execute the shell commands. Available APIs are “open3” (default) and “posix-spawn” (requires the “posix-spawn” gem).
@return [String]
If you don't want commands to take too long, you can set a timeout (in seconds).
@return [Integer]
If set to `true`, it will `identify` every newly created image, and raise `MiniMagick::Invalid` if the image is not valid. Useful for validating user input, although it adds a bit of overhead. Defaults to `true`.
@return [Boolean]
If set to `true`, it will `identify` every image that gets written (with {MiniMagick::Image#write}), and raise `MiniMagick::Invalid` if the image is not valid. Useful for validating that processing was sucessful, although it adds a bit of overhead. Defaults to `true`.
@return [Boolean]
If set to `false`, it will not raise errors when ImageMagick returns status code different than 0. Defaults to `true`.
@return [Boolean]
Public Class Methods
# File lib/mini_magick/configuration.rb, line 96 def self.extended(base) base.validate_on_create = true base.validate_on_write = true base.whiny = true base.shell_api = "open3" base.logger = Logger.new($stdout).tap { |l| l.level = Logger::INFO } end
Public Instance Methods
# File lib/mini_magick/configuration.rb, line 143 def cli=(value) @cli = value if not CLI_DETECTION.key?(@cli) raise ArgumentError, "CLI has to be set to either :imagemagick, :imagemagick7 or :graphicsmagick" \ ", was set to #{@cli.inspect}" end end
@yield [self] @example
MiniMagick.configure do |config| config.cli = :graphicsmagick config.timeout = 5 end
# File lib/mini_magick/configuration.rb, line 112 def configure yield self end
# File lib/mini_magick/configuration.rb, line 157 def debug=(value) warn "MiniMagick.debug is deprecated and will be removed in MiniMagick 5. Use `MiniMagick.logger.level = Logger::DEBUG` instead." logger.level = value ? Logger::DEBUG : Logger::INFO end
# File lib/mini_magick/configuration.rb, line 128 def processor=(processor) @processor = processor.to_s unless CLI_DETECTION.value?(@processor) raise ArgumentError, "processor has to be set to either \"magick\", \"mogrify\" or \"gm\"" \ ", was set to #{@processor.inspect}" end end
Backwards compatibility
# File lib/mini_magick/configuration.rb, line 163 def reload_tools warn "MiniMagick.reload_tools is deprecated because it is no longer necessary" end