Class: TextExtractor::PlaintextHandler

Inherits:
FileHandler show all
Defined in:
lib/text_extractor/file_handler/plaintext_handler.rb

Constant Summary collapse

CONTENT_TYPES =
%w(text/csv text/plain)

Instance Method Summary collapse

Methods inherited from FileHandler

#accept?

Constructor Details

#initializePlaintextHandler

Returns a new instance of PlaintextHandler.



6
7
8
# File 'lib/text_extractor/file_handler/plaintext_handler.rb', line 6

def initialize
  @content_types = CONTENT_TYPES
end

Instance Method Details

#text(file) ⇒ Object



10
11
12
# File 'lib/text_extractor/file_handler/plaintext_handler.rb', line 10

def text(file)
  TextExtractor::CodesetUtil.to_utf8 IO.read(file), 'UTF-8'
end