Class: MiniMagick::CommandBuilder

### Home Classes Methods

### In Files

- lib/mini_magick.rb

### Parent

Object

### Methods

- ::new
- #+
- #<<
- #add_command
- #add_creation_operator
- #args
- #command
- #format
- #push

### Class/Module Index

Quicksearch

- MiniMagick
- MiniMagick::CommandBuilder
- MiniMagick::Error
- MiniMagick::Image
- MiniMagick::Invalid

No matching classes.

# MiniMagick::CommandBuilder

### Public Class Methods

new(tool, *options) click to toggle source

    # File lib/mini_magick.rb, line 435
    def initialize(tool, *options)
      @tool = tool
      @args = []
      options.each { |arg| push(arg) }
    end

### Public Instance Methods

+(*options) click to toggle source

    # File lib/mini_magick.rb, line 485
    def +(*options)
      push(@args.pop.gsub(/^-/, '+'))
      if options.any?
        options.each do |o|
          push o
        end
      end
    end

<<(arg) click to toggle source
Alias for: push
add_command(command, *options) click to toggle source

    # File lib/mini_magick.rb, line 494
    def add_command(command, *options)
      push "-#{command}"
      if options.any?
        options.each do |o|
          push o
        end
      end
    end

add_creation_operator(command, *options) click to toggle source

    # File lib/mini_magick.rb, line 503
    def add_creation_operator(command, *options)
      creation_command = command
      if options.any?
        options.each do |option|
          creation_command << ":#{option}"
        end
      end
      push creation_command
    end

args() click to toggle source

    # File lib/mini_magick.rb, line 449
    def args
      @args.map(&:shellescape)
    end

command() click to toggle source

    # File lib/mini_magick.rb, line 441
    def command
      com = "#{@tool} #{args.join(' ')}".strip
      com = "#{MiniMagick.processor} #{com}" unless MiniMagick.processor.nil?

      com = File.join MiniMagick.processor_path, com unless MiniMagick.processor_path.nil?
      com.strip
    end

format(*options) click to toggle source

    # File lib/mini_magick.rb, line 474
    def format(*options)
      raise Error, "You must call 'format' on the image object directly!"
    end

push(arg) click to toggle source

    # File lib/mini_magick.rb, line 513
    def push(arg)
      @args << arg.to_s.strip
    end

Also aliased as: <<

[Validate]

Generated with the Darkfish Rdoc Generator 2.