Module: PDFUtilities
- Defined in:
- lib/pdf_utilities/datestamp_pdf.rb,
lib/pdf_utilities/pdf_validator.rb
Overview
Utility classes and functions for VA PDF
Defined Under Namespace
Modules: PDFValidator Classes: DatestampPdf
Constant Summary collapse
- PDFTK =
PdfForms.new(Settings.binaries.pdftk)
Class Method Summary collapse
Class Method Details
.formatted_file_size(file_size_in_bytes) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pdf_utilities/pdf_validator.rb', line 6 def self.formatted_file_size(file_size_in_bytes) bytes_per_gb = 1_000_000_000 bytes_per_mb = 1_000_000 bytes_per_kb = 1_000 if file_size_in_bytes >= bytes_per_gb "#{format('%g', (file_size_in_bytes.to_f / bytes_per_gb))} GB" elsif file_size_in_bytes >= bytes_per_mb "#{format('%g', (file_size_in_bytes.to_f / bytes_per_mb))} MB" elsif file_size_in_bytes >= bytes_per_kb "#{format('%g', (file_size_in_bytes.to_f / bytes_per_kb))} KB" else "#{file_size_in_bytes} bytes" end end |