Class: Plaintext::PlaintextHandler
- Inherits:
-
FileHandler
- Object
- FileHandler
- Plaintext::PlaintextHandler
- Defined in:
- lib/plaintext/file_handler/plaintext_handler.rb
Constant Summary collapse
- CONTENT_TYPES =
%w(text/csv text/plain)
Instance Method Summary collapse
-
#initialize ⇒ PlaintextHandler
constructor
A new instance of PlaintextHandler.
- #text(file, options = {}) ⇒ Object
Methods inherited from FileHandler
Constructor Details
#initialize ⇒ PlaintextHandler
Returns a new instance of PlaintextHandler.
7 8 9 |
# File 'lib/plaintext/file_handler/plaintext_handler.rb', line 7 def initialize @content_types = CONTENT_TYPES end |
Instance Method Details
#text(file, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/plaintext/file_handler/plaintext_handler.rb', line 11 def text(file, = {}) max_size = [:max_size] Plaintext::CodesetUtil.to_utf8 IO.read(file, max_size), 'UTF-8' end |