Class: PDFUtilities::PDFValidator::Validator
- Inherits:
-
Object
- Object
- PDFUtilities::PDFValidator::Validator
- Defined in:
- lib/pdf_utilities/pdf_validator.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ size_limit_in_bytes: 100_000_000, # 100 MB check_page_dimensions: true, check_encryption: true, # Height/width limits are ignored if the check_page_dimensions option is false. width_limit_in_inches: 21, height_limit_in_inches: 21 }.freeze
Instance Attribute Summary collapse
-
#pdf_metadata ⇒ Object
Returns the value of attribute pdf_metadata.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(file, options = {}) ⇒ Validator
constructor
‘file’ can be a File, Tempfile, or a String file path.
- #validate ⇒ Object
Constructor Details
#initialize(file, options = {}) ⇒ Validator
‘file’ can be a File, Tempfile, or a String file path
58 59 60 61 |
# File 'lib/pdf_utilities/pdf_validator.rb', line 58 def initialize(file, = {}) @file = file @options = DEFAULT_OPTIONS.merge() end |
Instance Attribute Details
#pdf_metadata ⇒ Object
Returns the value of attribute pdf_metadata.
55 56 57 |
# File 'lib/pdf_utilities/pdf_validator.rb', line 55 def @pdf_metadata end |
#result ⇒ Object
Returns the value of attribute result.
55 56 57 |
# File 'lib/pdf_utilities/pdf_validator.rb', line 55 def result @result end |
Instance Method Details
#validate ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/pdf_utilities/pdf_validator.rb', line 63 def validate @result = ValidationResult.new @pdf_metadata = nil check_file_size check_encryption if @options[:check_encryption] check_page_size if @options[:check_page_dimensions] @result end |