Module: RCheck::Formatting

Defined in:
lib/rcheck/formatting.rb

Class Method Summary collapse

Class Method Details

.truncate(*lines) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/rcheck/formatting.rb', line 3

def self.truncate(*lines)
  lines.map do |line|
    if line.length < Conf[:max_cols]
      line
    else
      msg = ".. [#{line.length} c]"
      "#{line[0..(Conf[:max_cols] - msg.length)]}#{msg}"
    end
  end
end