Class: FilterRename::PdfFilename
- Defined in:
- lib/filter_rename/filetype/pdf_filename.rb
Instance Attribute Summary
Attributes inherited from Filename
Instance Method Summary collapse
-
#initialize(fname, cfg) ⇒ PdfFilename
constructor
A new instance of PdfFilename.
Methods inherited from Filename
#!=, #==, #calculate_hash, #custom?, #diff, #exists?, #filename, #full_filename, #full_path, #get_string, #has_target?, has_writable_tags, #pretty_size, #rename!, #set_string, #targets, #values, #writable?
Constructor Details
#initialize(fname, cfg) ⇒ PdfFilename
Returns a new instance of PdfFilename.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/filter_rename/filetype/pdf_filename.rb', line 7 def initialize(fname, cfg) super fname, cfg if cfg. pdfinfo = PDF::Reader.new(fname) @page_count = pdfinfo.page_count.to_s @page_count.readonly! pdfinfo.info.each do |key, value| (key.to_s.gsub(/([A-Z])([^A-Z]+)/, '\1\2 ').strip, value, true) end unless pdfinfo.info.nil? end end |