Class: PDF::Reader::Reference
- Inherits:
-
Object
- Object
- PDF::Reader::Reference
- Defined in:
- lib/pdf/reader/reference.rb
Overview
An internal PDF::Reader class that represents an indirect reference to a PDF Object
Instance Attribute Summary collapse
-
#gen ⇒ Object
readonly
Returns the value of attribute gen.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.from_buffer(buffer) ⇒ Object
check if the next token in the buffer is a reference, and return a PDF::Reader::Reference instance.
Instance Method Summary collapse
-
#initialize(id, gen) ⇒ Reference
constructor
Create a new Reference to an object with the specified id and revision number.
-
#to_a ⇒ Object
returns the current Reference object in an array with a single element.
Constructor Details
#initialize(id, gen) ⇒ Reference
Create a new Reference to an object with the specified id and revision number
43 44 45 |
# File 'lib/pdf/reader/reference.rb', line 43 def initialize (id, gen) @id, @gen = id, gen end |
Instance Attribute Details
#gen ⇒ Object (readonly)
Returns the value of attribute gen.
40 41 42 |
# File 'lib/pdf/reader/reference.rb', line 40 def gen @gen end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
40 41 42 |
# File 'lib/pdf/reader/reference.rb', line 40 def id @id end |
Class Method Details
.from_buffer(buffer) ⇒ Object
check if the next token in the buffer is a reference, and return a PDF::Reader::Reference instance. Returns nil if the next token isn’t an indirect reference.
33 34 35 36 37 38 |
# File 'lib/pdf/reader/reference.rb', line 33 def self.from_buffer (buffer) buffer.ready_token return nil unless m = buffer.raw.match(/^(\d+)\s+(\d+)\s+R\b/) buffer.head(m[0].size) self.new(m[1].to_i, m[2].to_i) end |
Instance Method Details
#to_a ⇒ Object
returns the current Reference object in an array with a single element
48 49 50 |
# File 'lib/pdf/reader/reference.rb', line 48 def to_a [self] end |