Class: MultiExiftool::Writer
- Inherits:
-
Object
- Object
- MultiExiftool::Writer
- Includes:
- Executable
- Defined in:
- lib/multi_exiftool/writer.rb
Overview
Handle writing of metadata via exiftool. Composing the command for the command-line executing it and parsing possible errors.
Instance Attribute Summary collapse
-
#overwrite_original ⇒ Object
Returns the value of attribute overwrite_original.
-
#values ⇒ Object
Returns the value of attribute values.
Attributes included from Executable
#config, #errors, #filenames, #numerical
Class Method Summary collapse
Instance Method Summary collapse
-
#exiftool_args ⇒ Object
Getting the command-line arguments which would be executed when calling #write.
-
#initialize(filenames = [], values = {}, opts = {}) ⇒ Writer
constructor
A new instance of Writer.
-
#options ⇒ Object
Options to use with the exiftool command.
Methods included from Executable
Constructor Details
#initialize(filenames = [], values = {}, opts = {}) ⇒ Writer
Returns a new instance of Writer.
17 18 19 20 |
# File 'lib/multi_exiftool/writer.rb', line 17 def initialize filenames=[], values={}, opts={} super(filenames, opts) @values = values end |
Instance Attribute Details
#overwrite_original ⇒ Object
Returns the value of attribute overwrite_original.
13 14 15 |
# File 'lib/multi_exiftool/writer.rb', line 13 def overwrite_original @overwrite_original end |
#values ⇒ Object
Returns the value of attribute values.
13 14 15 |
# File 'lib/multi_exiftool/writer.rb', line 13 def values @values end |
Class Method Details
.mandatory_args ⇒ Object
22 23 24 |
# File 'lib/multi_exiftool/writer.rb', line 22 def self.mandatory_args %w(-charset FileName=utf8 -charset utf8) 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 maybe even for creating a batch-file with exiftool command to be processed.
37 38 39 40 41 42 43 44 45 |
# File 'lib/multi_exiftool/writer.rb', line 37 def exiftool_args fail MultiExiftool::Error, 'No filenames.' if filenames.empty? cmd = [] cmd << Writer.mandatory_args cmd << cmd << values_args cmd << filenames cmd.flatten end |
#options ⇒ Object
Options to use with the exiftool command.
27 28 29 30 31 |
# File 'lib/multi_exiftool/writer.rb', line 27 def opts = super opts[:overwrite_original] = true if @overwrite_original opts end |