Class: MultiExiftool::Batch

Inherits:
Object
  • Object
show all
Includes:
Executable
Defined in:
lib/multi_exiftool/batch.rb

Overview

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

Instance Attribute Summary

Attributes included from Executable

#config, #errors, #filenames, #numerical, #options

Instance Method Summary collapse

Methods included from Executable

#execute

Constructor Details

#initialize(&blk) ⇒ Batch

Define batch operation inside a block



15
16
17
18
# File 'lib/multi_exiftool/batch.rb', line 15

def initialize &blk
  @writers = []
  instance_exec &blk if block_given?
end

Instance Method Details

#exiftool_argsObject

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



29
30
31
# File 'lib/multi_exiftool/batch.rb', line 29

def exiftool_args
  @writers.map {|w| w.exiftool_args + ['-execute']}.flatten
end

#write(filenames, values, options = {}) ⇒ Object

Define a write operation for the batch.



21
22
23
24
# File 'lib/multi_exiftool/batch.rb', line 21

def write filenames, values, options={}
  w = MultiExiftool::Writer.new(filenames, values, options)
  @writers << w
end