Class: TxtContentExtractor

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

Defined Under Namespace

Classes: ExtractionError, FileDownloadError, FileReadError

Constant Summary collapse

WORDS_PER_PAGE =
500

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ TxtContentExtractor

Returns a new instance of TxtContentExtractor.



15
16
17
# File 'lib/content_extractors/text_content_extractor.rb', line 15

def initialize(file)
  @file = file
end

Instance Attribute Details

#page_countObject (readonly)

Returns the value of attribute page_count.



6
7
8
# File 'lib/content_extractors/text_content_extractor.rb', line 6

def page_count
  @page_count
end

Instance Method Details

#callObject



19
20
21
22
23
# File 'lib/content_extractors/text_content_extractor.rb', line 19

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