module TDL::Util
Public Class Methods
compress_data(data)
click to toggle source
# File lib/tdl/util.rb, line 17 def self.compress_data(data) if data.respond_to?(:split) "#{TDL::Util.compress_text(data)}" else "#{data}" end end
compress_text(text)
click to toggle source
# File lib/tdl/util.rb, line 3 def self.compress_text(text) # DEBT compress text should not add quotes top_line, *remaing_content = text.split("\n") lines_remaining = remaing_content.size if lines_remaining > 1 "\"#{top_line} .. ( #{lines_remaining} more lines )\"" elsif lines_remaining == 1 "\"#{top_line} .. ( 1 more line )\"" else "\"#{top_line}\"" end end