Sha256: f389e9b7f9096dfbb12e68b7c87632513f1e0ffa6582fd72adab429c06eb70a0
Contents?: true
Size: 573 Bytes
Versions: 13
Compression:
Stored size: 573 Bytes
Contents
module DeepCover module Tools::NumberLines def number_lines(lines, lineno: 1, bad_linenos: []) max_lineno = lineno + lines.size - 1 nb_lineno_digits = max_lineno.to_s.size lines.map.with_index do |line, i| cur_lineno = lineno + i cur_lineno_s = cur_lineno.to_s.rjust(nb_lineno_digits) if bad_linenos.include?(cur_lineno) prefix = Term::ANSIColor.red("#{cur_lineno_s} | ") else prefix = Term::ANSIColor.white("#{cur_lineno_s} | ") end "#{prefix}#{line}" end end end end
Version data entries
13 entries across 13 versions & 1 rubygems