class MultiExiftool::Batch

Allow to define a batch for different writing operations as one call of the ExifTool command-line application

Public Class Methods

new(&blk) click to toggle source

Define batch operation inside a block

# File lib/multi_exiftool/batch.rb, line 15
def initialize &blk
  @writers = []
  instance_exec &blk if block_given?
end

Public Instance Methods

exiftool_args() click to toggle source

Getting the command-line arguments which would be executed when calling write. It could be useful for logging, debugging or whatever.

# File lib/multi_exiftool/batch.rb, line 29
def exiftool_args
  @writers.map {|w| w.exiftool_args + ['-execute']}.flatten
end
write(filenames, values, options={}) click to toggle source

Define a write operation for the batch.

# File lib/multi_exiftool/batch.rb, line 21
def write filenames, values, options={}
  w = MultiExiftool::Writer.new(filenames, values, options)
  @writers << w
end

Private Instance Methods

parse_results() click to toggle source
# File lib/multi_exiftool/batch.rb, line 35
def parse_results
  @errors = @stderr.read.split(/\n/)
  @errors.empty?
end