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:



44
45
46
# File 'lib/pdf/reader/error.rb', line 44

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:



32
33
34
35
36
# File 'lib/pdf/reader/error.rb', line 32

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:



38
39
40
41
42
# File 'lib/pdf/reader/error.rb', line 38

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