Module: MiniMagick
- Defined in:
- lib/mini_magick.rb,
lib/mini_magick/image.rb,
lib/mini_magick/errors.rb,
lib/mini_magick/version.rb,
lib/mini_magick/utilities.rb,
lib/mini_magick/command_builder.rb
Defined Under Namespace
Modules: Utilities Classes: CommandBuilder, Error, Image, Invalid
Constant Summary collapse
- VERSION =
'3.8.0'
Class Attribute Summary collapse
-
.processor ⇒ Object
Returns the value of attribute processor.
-
.processor_path ⇒ Object
Returns the value of attribute processor_path.
-
.timeout ⇒ Object
Returns the value of attribute timeout.
-
.validate_on_create ⇒ Object
Returns the value of attribute validate_on_create.
-
.validate_on_write ⇒ Object
Returns the value of attribute validate_on_write.
Class Method Summary collapse
-
.choose_processor ⇒ Object
Tries to detect the current processor based if any of the processors exist.
-
.gm? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s graphicsmagick or not.
-
.image_magick_version ⇒ Object
Discovers the imagemagick version based on mogrify’s output.
-
.minimum_image_magick_version ⇒ Object
The minimum allowed imagemagick version.
-
.mogrify? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s mogrify or not.
-
.valid_version_installed? ⇒ Boolean
Checks whether the imagemagick’s version is valid.
Class Attribute Details
.processor ⇒ Object
Returns the value of attribute processor.
16 17 18 |
# File 'lib/mini_magick.rb', line 16 def processor @processor end |
.processor_path ⇒ Object
Returns the value of attribute processor_path.
17 18 19 |
# File 'lib/mini_magick.rb', line 17 def processor_path @processor_path end |
.timeout ⇒ Object
Returns the value of attribute timeout.
18 19 20 |
# File 'lib/mini_magick.rb', line 18 def timeout @timeout end |
.validate_on_create ⇒ Object
Returns the value of attribute validate_on_create.
19 20 21 |
# File 'lib/mini_magick.rb', line 19 def validate_on_create @validate_on_create end |
.validate_on_write ⇒ Object
Returns the value of attribute validate_on_write.
20 21 22 |
# File 'lib/mini_magick.rb', line 20 def validate_on_write @validate_on_write end |
Class Method Details
.choose_processor ⇒ Object
Tries to detect the current processor based if any of the processors exist. Mogrify have precedence over gm by default.
Returns
- String
-
The detected procesor
28 29 30 31 32 33 34 35 36 |
# File 'lib/mini_magick.rb', line 28 def choose_processor self.processor = if MiniMagick::Utilities.which('mogrify') :mogrify elsif MiniMagick::Utilities.which('gm') :gm else nil end end |
.gm? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s graphicsmagick or not.
Returns
- Boolean
82 83 84 85 86 87 |
# File 'lib/mini_magick.rb', line 82 def gm? choose_processor if processor.nil? return processor.to_s.downcase.to_sym == :gm unless processor.nil? false end |
.image_magick_version ⇒ Object
Discovers the imagemagick version based on mogrify’s output.
Returns
-
The imagemagick version
43 44 45 |
# File 'lib/mini_magick.rb', line 43 def image_magick_version @@version ||= Gem::Version.create(`mogrify --version`.split(' ')[2].split('-').first) end |
.minimum_image_magick_version ⇒ Object
The minimum allowed imagemagick version
Returns
-
The minimum imagemagick version
52 53 54 |
# File 'lib/mini_magick.rb', line 52 def minimum_image_magick_version @@minimum_version ||= Gem::Version.create('6.6.3') end |
.mogrify? ⇒ Boolean
Picks the right processor if it isn’t set and returns whether it’s mogrify or not.
Returns
- Boolean
70 71 72 73 74 75 |
# File 'lib/mini_magick.rb', line 70 def mogrify? choose_processor if processor.nil? return processor.to_s.downcase.to_sym == :mogrify unless processor.nil? false end |
.valid_version_installed? ⇒ Boolean
Checks whether the imagemagick’s version is valid
Returns
- Boolean
61 62 63 |
# File 'lib/mini_magick.rb', line 61 def valid_version_installed? image_magick_version >= minimum_image_magick_version end |