Module: MiniMagick::Configuration
- Included in:
- MiniMagick
- Defined in:
- lib/mini_magick/configuration.rb
Instance Attribute Summary collapse
-
#cli_env ⇒ Hash
Adds environment variables to every CLI command call.
-
#cli_prefix ⇒ String+
Adds a prefix to the CLI command.
-
#errors ⇒ Boolean
If set to ‘false`, it will not raise errors when ImageMagick returns status code different than 0.
-
#graphicsmagick ⇒ Boolean
Uses [GraphicsMagick](www.graphicsmagick.org/) instead of ImageMagick, by prefixing commands with ‘gm` instead of `magick`.
-
#logger ⇒ Logger
Logger for commands, default is ‘Logger.new($stdout)`, but you can override it, for example if you want the logs to be written to a file.
-
#restricted_env ⇒ Boolean
If set to true, Open3 will restrict system calls to access only environment variables defined in :cli_env, plus HOME, PATH, and LANG since those are required for such system calls.
-
#timeout ⇒ Integer
If you don’t want commands to take too long, you can set a timeout (in seconds).
-
#tmpdir ⇒ String
Temporary directory used by MiniMagick, default is ‘Dir.tmpdir`, but you can override it.
-
#warnings ⇒ Object
If set to ‘false`, it will not forward warnings from ImageMagick to standard error.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cli_env ⇒ Hash
Adds environment variables to every CLI command call. For example, you could use it to set ‘LD_PRELOAD=“/path/to/libsomething.so”`. Must be a hash of strings keyed to valid environment variable name strings. e.g. => ‘my value’
33 34 35 |
# File 'lib/mini_magick/configuration.rb', line 33 def cli_env @cli_env end |
#cli_prefix ⇒ 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’]
23 24 25 |
# File 'lib/mini_magick/configuration.rb', line 23 def cli_prefix @cli_prefix end |
#errors ⇒ Boolean
If set to ‘false`, it will not raise errors when ImageMagick returns status code different than 0. Defaults to `true`.
73 74 75 |
# File 'lib/mini_magick/configuration.rb', line 73 def errors @errors end |
#graphicsmagick ⇒ Boolean
Uses [GraphicsMagick](www.graphicsmagick.org/) instead of ImageMagick, by prefixing commands with ‘gm` instead of `magick`.
12 13 14 |
# File 'lib/mini_magick/configuration.rb', line 12 def graphicsmagick @graphicsmagick end |
#logger ⇒ Logger
Logger for commands, default is ‘Logger.new($stdout)`, but you can override it, for example if you want the logs to be written to a file.
58 59 60 |
# File 'lib/mini_magick/configuration.rb', line 58 def logger @logger end |
#restricted_env ⇒ Boolean
If set to true, Open3 will restrict system calls to access only environment variables defined in :cli_env, plus HOME, PATH, and LANG since those are required for such system calls. It will not pass on any other environment variables from the system.
43 44 45 |
# File 'lib/mini_magick/configuration.rb', line 43 def restricted_env @restricted_env end |
#timeout ⇒ Integer
If you don’t want commands to take too long, you can set a timeout (in seconds).
51 52 53 |
# File 'lib/mini_magick/configuration.rb', line 51 def timeout @timeout end |
#tmpdir ⇒ String
Temporary directory used by MiniMagick, default is ‘Dir.tmpdir`, but you can override it.
65 66 67 |
# File 'lib/mini_magick/configuration.rb', line 65 def tmpdir @tmpdir end |
#warnings ⇒ Object
If set to ‘false`, it will not forward warnings from ImageMagick to standard error.
78 79 80 |
# File 'lib/mini_magick/configuration.rb', line 78 def warnings @warnings end |
Class Method Details
.extended(base) ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/mini_magick/configuration.rb', line 80 def self.extended(base) base.tmpdir = Dir.tmpdir base.errors = true base.logger = Logger.new($stdout).tap { |l| l.level = Logger::INFO } base.warnings = true base.cli_env = {}.freeze base.restricted_env = false base.graphicsmagick = false end |
Instance Method Details
#configure {|self| ... } ⇒ Object
97 98 99 |
# File 'lib/mini_magick/configuration.rb', line 97 def configure yield self end |