Class: Pdfrb::Model::Type::StructTreeRoot

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

Overview

Structure tree root (s14.7.2). Catalog /StructTreeRoot. Holds /Type, /K, /ParentTree, /ParentTreeNextKey, /RoleMap, /ClassMap.

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

#childrenObject



14
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 14

def children; self[:K]; end

#class_mapObject



18
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 18

def class_map; self[:ClassMap]; end

#each_childObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 20

def each_child
  return enum_for(:each_child) unless block_given?
  return unless children && document

  arr = children.is_a?(Pdfrb::Model::Reference) ? document.object(children) : children
  return unless arr.is_a?(Array) || arr.is_a?(Pdfrb::Model::PdfArray)

  arr.each do |kid_ref|
    obj = kid_ref.is_a?(Pdfrb::Model::Reference) ? document.object(kid_ref) : kid_ref
    yield obj if obj
  end
end

#has_class_map?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 43

def has_class_map?
  !!class_map
end

#has_role_map?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 39

def has_role_map?
  !!role_map
end

#mapped_role(custom_name) ⇒ Object



33
34
35
36
37
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 33

def mapped_role(custom_name)
  return nil unless role_map.is_a?(::Hash)

  role_map[custom_name.to_sym] || role_map[custom_name.to_s]
end

#parent_treeObject



15
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 15

def parent_tree; self[:ParentTree]; end

#parent_tree_next_keyObject



16
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 16

def parent_tree_next_key; self[:ParentTreeNextKey]; end

#role_mapObject



17
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 17

def role_map; self[:RoleMap]; end

#typeObject



13
# File 'lib/pdfrb/model/type/struct_tree_root.rb', line 13

def type; self[:Type]; end