Sha256: 623e505d21967b6a263e6e77a1593e23878a5ec14e761e3cc8ca887b56360509

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

require 'mini_magick/version'
require 'mini_magick/configuration'

module MiniMagick

  extend MiniMagick::Configuration

  ##
  # You might want to execute only certain blocks of processing with a
  # different CLI, because for example that CLI does that particular thing
  # faster. After the block CLI resets to its previous value.
  #
  # @example
  #   MiniMagick.with_cli :graphicsmagick do
  #     # operations that are better done with GraphicsMagick
  #   end
  def self.with_cli(cli)
    old_cli = self.cli
    self.cli = cli
    yield
  ensure
    self.cli = old_cli
  end

  ##
  # Checks whether the CLI used is ImageMagick.
  #
  # @return [Boolean]
  def self.imagemagick?
    cli == :imagemagick
  end

  ##
  # Checks whether the CLI used is GraphicsMagick.
  #
  # @return [Boolean]
  def self.graphicsmagick?
    cli == :graphicsmagick
  end

  ##
  # Returns ImageMagick's/GraphicsMagick's version.
  #
  # @return [String]
  def self.cli_version
    output = MiniMagick::Tool::Identify.new(&:version)
    output[/\d+\.\d+\.\d+(-\d+)?/]
  end

  class Error < RuntimeError; end
  class Invalid < StandardError; end

end

require 'mini_magick/tool'
require 'mini_magick/image'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mini_magick-4.8.0 lib/mini_magick.rb
mini_magick-4.7.2 lib/mini_magick.rb
mini_magick-4.7.1 lib/mini_magick.rb
mini_magick-4.7.0 lib/mini_magick.rb
mini_magick-4.6.1 lib/mini_magick.rb
mini_magick-4.6.0 lib/mini_magick.rb
mini_magick-4.5.1 lib/mini_magick.rb
mini_magick-4.5.0 lib/mini_magick.rb
mini_magick-4.4.0 lib/mini_magick.rb
mini_magick-4.3.6 lib/mini_magick.rb
mini_magick-4.3.5 lib/mini_magick.rb