Sha256: a5377970298b8b7f214742aa29da88cbb20941bfb47b03370e3e22168c136c20
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require 'fileutils' require 'escape' class RemoteTable class Format module Textual USELESS_CHARACTERS = [ '\xef\xbb\xbf', # UTF-8 byte order mark '\xc2\xad' # soft hyphen, often inserted by MS Office (html: ­) ] def remove_useless_characters! ::RemoteTable.executor.bang t.local_file.path, "perl -pe 's/#{USELESS_CHARACTERS.join '//g; s/'}//g'" end def skip_rows! return unless t.properties.skip > 0 ::RemoteTable.executor.bang t.local_file.path, "tail -n +#{t.properties.skip + 1}" end def crop_rows! return unless t.properties.crop ::RemoteTable.executor.bang t.local_file.path, "tail -n +#{::Escape.shell_single_word t.properties.crop.first.to_s} | head -n #{t.properties.crop.last - t.properties.crop.first + 1}" end def cut_columns! return unless t.properties.cut ::RemoteTable.executor.bang t.local_file.path, "cut -c #{::Escape.shell_single_word t.properties.cut.to_s}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
remote_table-1.1.8 | lib/remote_table/format/mixins/textual.rb |
remote_table-1.1.7 | lib/remote_table/format/mixins/textual.rb |