Class: PDF::Reader::Error
- Inherits:
-
Object
- Object
- PDF::Reader::Error
- Defined in:
- lib/pdf/reader/error.rb
Overview
An internal PDF::Reader class that helps to verify various parts of the PDF file are valid
Class Method Summary collapse
- .assert_equal(lvalue, rvalue) ⇒ Object
-
.str_assert(lvalue, rvalue, chars = nil) ⇒ Object
:nodoc:.
- .str_assert_not(lvalue, rvalue, chars = nil) ⇒ Object
Class Method Details
.assert_equal(lvalue, rvalue) ⇒ Object
43 44 45 |
# File 'lib/pdf/reader/error.rb', line 43 def self.assert_equal (lvalue, rvalue) raise MalformedPDFError, "PDF malformed, expected #{rvalue} but found #{lvalue} instead" if lvalue != rvalue end |
.str_assert(lvalue, rvalue, chars = nil) ⇒ Object
:nodoc:
31 32 33 34 35 |
# File 'lib/pdf/reader/error.rb', line 31 def self.str_assert (lvalue, rvalue, chars=nil) raise MalformedPDFError, "PDF malformed, expected string but found #{lvalue.class} instead" if chars and !lvalue.kind_of?(String) lvalue = lvalue[0,chars] if chars raise MalformedPDFError, "PDF malformed, expected '#{rvalue}' but found #{lvalue} instead" if lvalue != rvalue end |
.str_assert_not(lvalue, rvalue, chars = nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/pdf/reader/error.rb', line 37 def self.str_assert_not (lvalue, rvalue, chars=nil) raise MalformedPDFError, "PDF malformed, expected string but found #{lvalue.class} instead" if chars and !lvalue.kind_of?(String) lvalue = lvalue[0,chars] if chars raise MalformedPDFError, "PDF malformed, expected '#{rvalue}' but found #{lvalue} instead" if lvalue == rvalue end |