Class: Pdfmdclean
Overview
Class: pdfmdclean
Clean metadata from a document
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#tags ⇒ Object
Returns the value of attribute tags.
Attributes inherited from Pdfmd
Instance Method Summary collapse
-
#initialize(filename) ⇒ Pdfmdclean
constructor
A new instance of Pdfmdclean.
-
#run ⇒ Object
Run the actual cleaning.
Methods inherited from Pdfmd
#check_metatags, #metadata, #readUserInput, #read_metatags
Methods included from Pdfmdmethods
#determineValidSetting, #log, #queryHiera
Constructor Details
#initialize(filename) ⇒ Pdfmdclean
Returns a new instance of Pdfmdclean.
9 10 11 |
# File 'lib/pdfmd/pdfmdclean.rb', line 9 def initialize(filename) super(filename) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
7 8 9 |
# File 'lib/pdfmd/pdfmdclean.rb', line 7 def filename @filename end |
#tags ⇒ Object
Returns the value of attribute tags.
7 8 9 |
# File 'lib/pdfmd/pdfmdclean.rb', line 7 def @tags end |
Instance Method Details
#run ⇒ Object
Run the actual cleaning
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pdfmd/pdfmdclean.rb', line 14 def run() # Figure out which tags actually to reset. if @tags.nil? or @tags == 'all' @tags = @@default_tags elsif @tags.is_a?(String) @tags = @tags.split(',') end # Create the command to delete all the metatags command = 'exiftool' parameter = ' -overwrite_original' @tags.each do |current_tag| parameter << " -#{current_tag}=" end parameter << ' ' `#{command} #{parameter} #{@filename}` self.log('info', "Cleaning tags '#{@tags.join(', ').to_s}' from file '#{@filename}'.") end |