Class: Rpdf2txt::TreeNode
- Includes:
- Enumerable
- Defined in:
- lib/rpdf2txt/object.rb
Direct Known Subclasses
CatalogNode, PageLeaf, PageNode, PdfArray, PdfHash, ReferenceArray
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from PdfObject
#attributes, #decoder, #oid, #src
Instance Method Summary collapse
- #build_tree(object_catalogue, parent = nil) ⇒ Object
- #each {|_self| ... } ⇒ Object
- #extract_oids(array) ⇒ Object
- #root? ⇒ Boolean
Methods inherited from PdfObject
#_parse_attributes, #catalogue_object, #decoded_stream, #extract_attribute_stream, #initialize, #parse_attributes, #revision_id
Constructor Details
This class inherits a constructor from Rpdf2txt::PdfObject
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
446 447 448 |
# File 'lib/rpdf2txt/object.rb', line 446 def parent @parent end |
Instance Method Details
#build_tree(object_catalogue, parent = nil) ⇒ Object
447 448 449 450 451 |
# File 'lib/rpdf2txt/object.rb', line 447 def build_tree(object_catalogue, parent=nil) super @parent = parent self end |
#each {|_self| ... } ⇒ Object
452 453 454 |
# File 'lib/rpdf2txt/object.rb', line 452 def each yield self end |
#extract_oids(array) ⇒ Object
455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/rpdf2txt/object.rb', line 455 def extract_oids(array) if array.class != Array array = [array] end result = array.collect{ |dirty_id| if(match = /\d+/on.match(dirty_id)) match[0].to_i end }.compact return result end |
#root? ⇒ Boolean
466 467 468 |
# File 'lib/rpdf2txt/object.rb', line 466 def root? !(@parent || @attributes[:parent]) end |