Class: MultiExiftool::Batch
- Inherits:
-
Object
- Object
- MultiExiftool::Batch
- 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
-
#exiftool_args ⇒ Object
Getting the command-line arguments which would be executed when calling #write.
-
#initialize(&blk) ⇒ Batch
constructor
Define batch operation inside a block.
-
#write(filenames, values, options = {}) ⇒ Object
Define a write operation for the batch.
Methods included from Executable
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_args ⇒ Object
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, ={} w = MultiExiftool::Writer.new(filenames, values, ) @writers << w end |