Parent

MiniMagick::CommandBuilder

Attributes

args[R]
command[R]

Public Class Methods

new(command, *options) click to toggle source
# File lib/mini_magick.rb, line 446
def initialize(command, *options)
  @command = command
  @args = []
  options.each { |arg| push(arg) }
end

Public Instance Methods

+(*options) click to toggle source
# File lib/mini_magick.rb, line 471
def +(*options)
  push(@args.pop.gsub(/^-/, '+'))
  if options.any?
    options.each do |o|
      push escape_string(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 480
def add_command(command, *options)
  push "-#{command}"
  if options.any?
    options.each do |o|
      push escape_string(o)
    end
  end
end
add_creation_operator(command, *options) click to toggle source
# File lib/mini_magick.rb, line 493
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
escape_string(value) click to toggle source
# File lib/mini_magick.rb, line 489
def escape_string(value)
  '"' + value + '"'
end
method_missing(symbol, *options) click to toggle source
# File lib/mini_magick.rb, line 456
def method_missing(symbol, *options)
  guessed_command_name = symbol.to_s.gsub('_','-')
  if guessed_command_name == "format"
    raise Error, "You must call 'format' on the image object directly!"
  elsif MOGRIFY_COMMANDS.include?(guessed_command_name)
    add_command(guessed_command_name, *options)
    self
  elsif IMAGE_CREATION_OPERATORS.include?(guessed_command_name)
    add_creation_operator(guessed_command_name, *options)
    self
  else
    super(symbol, *args)
  end
end
push(arg) click to toggle source
# File lib/mini_magick.rb, line 503
def push(arg)
  @args << arg.to_s.strip
end
Also aliased as: <<

[Validate]

Generated with the Darkfish Rdoc Generator 2.