class Origami::XRef::Section
Class representing a Cross-reference table. A section contains a set of XRefSubsection.
Constants
- TOKEN
Public Class Methods
new(subsections = [])
click to toggle source
Creates a new XRef
section.
- subsections
-
An array of XRefSubsection.
# File lib/origami/xreftable.rb, line 233 def initialize(subsections = []) @subsections = subsections end
Public Instance Methods
<<(subsection)
click to toggle source
Appends a new subsection.
- subsection
-
A XRefSubsection.
# File lib/origami/xreftable.rb, line 254 def <<(subsection) @subsections << subsection end
[](no)
click to toggle source
Returns a XRef
associated with a given object.
- no
-
The
Object
number.
# File lib/origami/xreftable.rb, line 262 def [](no) @subsections.each do |s| return s[no] if s.has_object?(no) end nil end
Also aliased as: find
clear()
click to toggle source
Clear all the entries.
# File lib/origami/xreftable.rb, line 310 def clear @subsections.clear end
each(&b)
click to toggle source
Processes each XRef
in each Subsection
.
# File lib/origami/xreftable.rb, line 274 def each(&b) return enum_for(__method__) { self.size } unless block_given? @subsections.each do |subsection| subsection.each(&b) end end
each_subsection(&b)
click to toggle source
Processes each Subsection
in this table.
# File lib/origami/xreftable.rb, line 296 def each_subsection(&b) @subsections.each(&b) end
each_with_number(&b)
click to toggle source
Processes each XRef
in each Subsection
, passing the XRef
and the object number.
# File lib/origami/xreftable.rb, line 285 def each_with_number(&b) return enum_for(__method__) { self.size } unless block_given? @subsections.each do |subsection| subsection.each_with_number(&b) end end
size()
click to toggle source
subsections()
click to toggle source
Returns an Array
of Subsection
.
# File lib/origami/xreftable.rb, line 303 def subsections @subsections end
to_s()
click to toggle source
Outputs self into PDF
code.
# File lib/origami/xreftable.rb, line 324 def to_s "xref" << EOL << @subsections.join end