Class: PdfProcessor::Abstract
- Inherits:
 - 
      Object
      
        
- Object
 - PdfProcessor::Abstract
 
 
- Defined in:
 - lib/pdf_processor.rb
 
Instance Method Summary collapse
- 
  
    
      #initialize(pdf_processor)  ⇒ Abstract 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
attr_accessor :reader.
 - #parse ⇒ Object
 
Constructor Details
#initialize(pdf_processor) ⇒ Abstract
attr_accessor :reader
      41 42 43 44 45 46 47  | 
    
      # File 'lib/pdf_processor.rb', line 41 def initialize(pdf_processor) @pdf_processor=pdf_processor @reader=pdf_processor.reader @mode=:pre @abstract_lines=[] @empty_lines=0 end  | 
  
Instance Method Details
#parse ⇒ Object
      63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83  | 
    
      # File 'lib/pdf_processor.rb', line 63 def parse # First, we locate the page on which is located the abstract page_for_abstract=@reader.pages[0..1].index {|page_n| page_n.text=~/Abstract/} return nil if page_for_abstract.nil? @pdf_processor.page(page_for_abstract).text.each_line do |r| line=r.chomp.lstrip if @mode==:pre and line=~/Abstract/ # We must include other languages @mode=:abstract # There is more information on this line? if (line_wo_abstract=(line.gsub(/(?:Abstract):?/,"")).lstrip)!="" @abstract_lines.push(line_wo_abstract) end elsif @mode==:abstract break if !parse_line_abstract(line) end end @abstract_lines.join("") end  |