Class: PDF::Reader::Error

Inherits:
Object
  • Object
show all
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

Class Method Details

.assert_equal(lvalue, rvalue) ⇒ Object

Raises:



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:

Raises:



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

Raises:



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