Module: MiniMagick::Configuration
- Included in:
- MiniMagick
- Defined in:
- lib/mini_magick/configuration.rb
Instance Attribute Summary collapse
-
#cli ⇒ Symbol
Set whether you want to use [ImageMagick](www.imagemagick.org) or [GraphicsMagick](www.graphicsmagick.org).
-
#cli_path ⇒ String
If you don’t have the CLI tools in your PATH, you can set the path to the executables.
-
#debug ⇒ Boolean
When set to ‘true`, it outputs each command to STDOUT in their shell version.
-
#logger ⇒ Logger
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.
- #processor ⇒ Object
- #processor_path ⇒ Object
-
#shell_api ⇒ String
Instructs MiniMagick how to execute the shell commands.
-
#timeout ⇒ Integer
If you don’t want commands to take too long, you can set a timeout (in seconds).
-
#validate_on_create ⇒ Boolean
If set to ‘true`, it will `identify` every newly created image, and raise `MiniMagick::Invalid` if the image is not valid.
-
#validate_on_write ⇒ Boolean
If set to ‘true`, it will `identify` every image that gets written (with Image#write), and raise `MiniMagick::Invalid` if the image is not valid.
-
#whiny ⇒ Boolean
If set to ‘false`, it will not raise errors when ImageMagick returns status code different than 0.
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|self| ... } ⇒ Object
-
#reload_tools ⇒ Object
Backwards compatibility.
Instance Attribute Details
#cli ⇒ Symbol
Set whether you want to use [ImageMagick](www.imagemagick.org) or [GraphicsMagick](www.graphicsmagick.org).
13 14 15 |
# File 'lib/mini_magick/configuration.rb', line 13 def cli @cli end |
#cli_path ⇒ String
If you don’t have the CLI tools in your PATH, you can set the path to the executables.
23 24 25 |
# File 'lib/mini_magick/configuration.rb', line 23 def cli_path @cli_path end |
#debug ⇒ Boolean
When set to ‘true`, it outputs each command to STDOUT in their shell version.
40 41 42 |
# File 'lib/mini_magick/configuration.rb', line 40 def debug @debug end |
#logger ⇒ Logger
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.
48 49 50 |
# File 'lib/mini_magick/configuration.rb', line 48 def logger @logger end |
#processor ⇒ Object
15 16 17 |
# File 'lib/mini_magick/configuration.rb', line 15 def processor @processor end |
#processor_path ⇒ Object
25 26 27 |
# File 'lib/mini_magick/configuration.rb', line 25 def processor_path @processor_path end |
#shell_api ⇒ String
Instructs MiniMagick how to execute the shell commands. Available APIs are “open3” (default) and “posix-spawn” (requires the “posix-spawn” gem).
83 84 85 |
# File 'lib/mini_magick/configuration.rb', line 83 def shell_api @shell_api end |
#timeout ⇒ Integer
If you don’t want commands to take too long, you can set a timeout (in seconds).
33 34 35 |
# File 'lib/mini_magick/configuration.rb', line 33 def timeout @timeout end |
#validate_on_create ⇒ Boolean
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`.
57 58 59 |
# File 'lib/mini_magick/configuration.rb', line 57 def validate_on_create @validate_on_create end |
#validate_on_write ⇒ Boolean
If set to ‘true`, it will `identify` every image that gets written (with 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`.
66 67 68 |
# File 'lib/mini_magick/configuration.rb', line 66 def validate_on_write @validate_on_write end |
#whiny ⇒ Boolean
If set to ‘false`, it will not raise errors when ImageMagick returns status code different than 0. Defaults to `true`.
74 75 76 |
# File 'lib/mini_magick/configuration.rb', line 74 def whiny @whiny end |
Class Method Details
.extended(base) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/mini_magick/configuration.rb', line 85 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 |
Instance Method Details
#configure {|self| ... } ⇒ Object
101 102 103 |
# File 'lib/mini_magick/configuration.rb', line 101 def configure yield self end |
#reload_tools ⇒ Object
Backwards compatibility
151 152 153 |
# File 'lib/mini_magick/configuration.rb', line 151 def reload_tools warn "MiniMagick.reload_tools is deprecated because it is no longer necessary" end |