Class: DocxContentExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/content_extractors/docx_content_extractor.rb

Defined Under Namespace

Classes: DocxProcessingError, ExtractionError, FileDownloadError, FileReadError

Constant Summary collapse

WORDS_PER_PAGE =
500

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ DocxContentExtractor

Returns a new instance of DocxContentExtractor.



17
18
19
# File 'lib/content_extractors/docx_content_extractor.rb', line 17

def initialize(file)
  @file = file
end

Instance Attribute Details

#page_countObject (readonly)

Returns the value of attribute page_count.



7
8
9
# File 'lib/content_extractors/docx_content_extractor.rb', line 7

def page_count
  @page_count
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/content_extractors/docx_content_extractor.rb', line 21

def call
  extract_content
rescue StandardError => e
  raise ExtractionError, "Content extraction failed: #{e.message}"
end