Class: Plaintext::XlsHandler

Inherits:
ExternalCommandHandler show all
Defined in:
lib/plaintext/file_handler/external_command_handler/xls_handler.rb

Constant Summary collapse

CONTENT_TYPES =
[
  'application/vnd.ms-excel',
  'application/excel'
]
DEFAULT =
[
    '/usr/bin/xls2csv', '-dutf-8', '__FILE__'
]

Constants inherited from ExternalCommandHandler

ExternalCommandHandler::DEFAULT_STREAM_ENCODING, ExternalCommandHandler::FILE_PLACEHOLDER

Instance Method Summary collapse

Methods inherited from ExternalCommandHandler

#accept?, #available?, available?, #shellout

Methods inherited from FileHandler

#accept?, #set

Constructor Details

#initializeXlsHandler

Returns a new instance of XlsHandler.



12
13
14
15
# File 'lib/plaintext/file_handler/external_command_handler/xls_handler.rb', line 12

def initialize
  @content_types = CONTENT_TYPES
  @command = Plaintext::Configuration['xls2csv'] || DEFAULT
end

Instance Method Details

#text(*_) ⇒ Object



16
17
18
19
20
# File 'lib/plaintext/file_handler/external_command_handler/xls_handler.rb', line 16

def text(*_)
  if str = super
    str.delete('"').gsub /,+/, ' '
  end
end