module PdfPageCount::FileUtil

Public Class Methods

find_pdf_files(path, recursive: false) click to toggle source
# File lib/pdf-page-count/file_util.rb, line 5
def find_pdf_files(path, recursive: false)
  if File.directory?(path)
    if recursive
      return Dir.glob("#{path}/**/*.pdf")
    else
      return Dir.glob("#{path}/*.pdf")
    end
  elsif path.end_with?(".pdf")
    return [path]
  else
    return []
  end
end

Private Instance Methods

find_pdf_files(path, recursive: false) click to toggle source
# File lib/pdf-page-count/file_util.rb, line 5
def find_pdf_files(path, recursive: false)
  if File.directory?(path)
    if recursive
      return Dir.glob("#{path}/**/*.pdf")
    else
      return Dir.glob("#{path}/*.pdf")
    end
  elsif path.end_with?(".pdf")
    return [path]
  else
    return []
  end
end