class DotDiff::CommandWrapper

Attributes

message[R]
pixels[R]

Public Instance Methods

failed?() click to toggle source
# File lib/dotdiff/command_wrapper.rb, line 25
def failed?
  @failed
end
passed?() click to toggle source
# File lib/dotdiff/command_wrapper.rb, line 21
def passed?
  !failed?
end
run(base_image, new_image, diff_image_path) click to toggle source
# File lib/dotdiff/command_wrapper.rb, line 9
def run(base_image, new_image, diff_image_path)
  output = run_command(base_image, new_image, diff_image_path)
  @message = output

  begin
    @pixels = Float(output)
    @failed = false
  rescue ArgumentError
    @failed = true
  end
end

Private Instance Methods

command(base_image, new_image, diff_image_path) click to toggle source
# File lib/dotdiff/command_wrapper.rb, line 35
def command(base_image, new_image, diff_image_path)
  "#{DotDiff.image_magick_diff_bin} #{DotDiff.image_magick_options} " \
  "#{Shellwords.escape(base_image)} #{Shellwords.escape(new_image)} " \
  "#{Shellwords.escape(diff_image_path)} 2>&1"
end
run_command(base_image, new_image, diff_image_path) click to toggle source
# File lib/dotdiff/command_wrapper.rb, line 31
def run_command(base_image, new_image, diff_image_path)
  `#{command(base_image, new_image, diff_image_path)}`.strip
end