Class: Pdfrb::Model::Type::Bead

Inherits:
Cos::Dictionary show all
Defined in:
lib/pdfrb/model/type/bead.rb

Overview

Bead (ISO 32000-2 §12.4.3, PDF 1.1+). A single rectangular portion of a page that is part of a Thread (article). Beads form a doubly-linked list via /N (next) and /V (previous).

Instance Attribute Summary

Attributes inherited from Object

#document, #gen, #oid, #value

Instance Method Summary collapse

Methods inherited from Cos::Dictionary

#[], #[]=, arlington_available?, arlington_default, arlington_key_to_symbol, arlington_loaded_for?, arlington_mark_loaded, arlington_object, arlington_one_type_to_ruby, arlington_required?, arlington_types_to_ruby, arlington_version, define_field, define_field_from_arlington, #delete, #each, each_field, #each_raw, #empty?, field, #initialize, #key?, #keys, lookup_type, own_fields, #pdf_type, register_type, type_map, #validate

Methods inherited from Object

#==, define_type, #deref, #indirect?, #initialize, #must_be_indirect?, #pdf_type, pdf_type

Constructor Details

This class inherits a constructor from Pdfrb::Model::Cos::Dictionary

Instance Method Details

#next_bead(document = nil) ⇒ Object

/N — required indirect next Bead.



26
27
28
29
30
31
# File 'lib/pdfrb/model/type/bead.rb', line 26

def next_bead(document = nil)
  ref = value[:N]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#page(document = nil) ⇒ Object

/P — required indirect Page the bead sits on.



42
43
44
45
46
47
# File 'lib/pdfrb/model/type/bead.rb', line 42

def page(document = nil)
  ref = value[:P]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#previous_bead(document = nil) ⇒ Object

/V — required indirect previous Bead.



34
35
36
37
38
39
# File 'lib/pdfrb/model/type/bead.rb', line 34

def previous_bead(document = nil)
  ref = value[:V]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#rectObject

/R — required rectangle on the page.



50
51
52
# File 'lib/pdfrb/model/type/bead.rb', line 50

def rect
  value[:R]
end

#thread(document = nil) ⇒ Object

/T — optional indirect Thread this bead belongs to.



18
19
20
21
22
23
# File 'lib/pdfrb/model/type/bead.rb', line 18

def thread(document = nil)
  ref = value[:T]
  return nil unless ref && document

  ref.is_a?(Pdfrb::Model::Reference) ? document.object(ref) : ref
end

#typeObject

/Type — optional, fixed "Bead".



13
14
15
# File 'lib/pdfrb/model/type/bead.rb', line 13

def type
  value[:Type]&.to_sym
end