Class: Pdfrb::Destination::Fit
- Inherits:
-
Object
- Object
- Pdfrb::Destination::Fit
show all
- Defined in:
- lib/pdfrb/destination/fit.rb
Overview
Destination fit types (ISO 32000-2 §12.3.2.2). Each type specifies
how the page should be displayed when navigated to.
OCP: new fit type = subclass + register_as.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(page_ref) ⇒ Fit
39
40
41
|
# File 'lib/pdfrb/destination/fit.rb', line 39
def initialize(page_ref)
@page_ref = page_ref
end
|
Instance Attribute Details
#page_ref ⇒ Object
Returns the value of attribute page_ref.
37
38
39
|
# File 'lib/pdfrb/destination/fit.rb', line 37
def page_ref
@page_ref
end
|
Class Method Details
.[](name) ⇒ Object
19
20
21
|
# File 'lib/pdfrb/destination/fit.rb', line 19
def [](name)
registry[name.to_sym]
end
|
.fit_keyword ⇒ Object
27
28
29
|
# File 'lib/pdfrb/destination/fit.rb', line 27
def fit_keyword
raise NotImplementedError
end
|
.register(name, klass) ⇒ Object
15
16
17
|
# File 'lib/pdfrb/destination/fit.rb', line 15
def register(name, klass)
registry[name.to_sym] = klass
end
|
.register_as(name = fit_keyword) ⇒ Object
31
32
33
34
|
# File 'lib/pdfrb/destination/fit.rb', line 31
def register_as(name = fit_keyword)
Fit.register(name, self)
self
end
|
.registry ⇒ Object
11
12
13
|
# File 'lib/pdfrb/destination/fit.rb', line 11
def registry
@registry ||= {}
end
|
.types ⇒ Object
23
24
25
|
# File 'lib/pdfrb/destination/fit.rb', line 23
def types
registry.keys
end
|
Instance Method Details
Serialize to the PDF destination array form.
45
46
47
|
# File 'lib/pdfrb/destination/fit.rb', line 45
def to_pdf
Pdfrb::Model::PdfArray.new([@page_ref, self.class.fit_keyword])
end
|