Class: Rpdf2txt::TreeNode

Inherits:
PdfObject show all
Includes:
Enumerable
Defined in:
lib/rpdf2txt/object.rb

Instance Attribute Summary collapse

Attributes inherited from PdfObject

#attributes, #decoder, #oid, #src

Instance Method Summary collapse

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

#parentObject (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

Yields:

  • (_self)

Yield Parameters:



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

Returns:

  • (Boolean)


466
467
468
# File 'lib/rpdf2txt/object.rb', line 466

def root?
  !(@parent || @attributes[:parent])
end