lib/docsplit/info_extractor.rb
def extract(key, pdfs, opts)
      pdf = [pdfs].flatten.first
      cmd = "pdfinfo #{pdf} 2>&1"
      result = `#{cmd}`.chomp
      raise ExtractionFailed, result if $? != 0
      match = result.match(MATCHERS[key])
      answer = match && match[1]
      answer = answer.to_i if answer && key == :length
      answer
    end
# Pull out a single datum from a pdf.
Pull out a single datum from a pdf.
Pull out a single datum from a pdf .
def extract(key, pdfs, opts)
      pdf = [pdfs].flatten.first
      cmd = "pdfinfo #{pdf} 2>&1"
      result = `#{cmd}`.chomp
      raise ExtractionFailed, result if $? != 0
      match = result.match(MATCHERS[key])
      answer = match && match[1]
      answer = answer.to_i if answer && key == :length
      answer
    end
def extract ( key , pdfs , opts ) pdf = [ pdfs ] . flatten . first cmd = "pdfinfo #{pdf} 2>&1" result = ` #{ cmd } ` . chomp raise ExtractionFailed , result if $? != 0 match = result . match ( MATCHERS [ key ] ) answer = match && match [ 1 ] answer = answer . to_i if answer && key == :length answer end
Pull out a single datum from a pdf.
Pull out a single datum from a pdf .
key
pdfs
opts