Class: Senju::Diff
- Inherits:
-
Object
- Object
- Senju::Diff
- Defined in:
- lib/senju/diff.rb
Class Method Summary collapse
Class Method Details
.print(patch) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/senju/diff.rb', line 2 def self.print(patch) patch.split("\n").map do |line| case line when /^(---|\+\+\+|\\\\)/ "\033[90m#{line.chomp}\033[0m" when /^\+/ "\033[32m#{line.chomp}\033[0m" when /^-/ "\033[31m#{line.chomp}\033[0m" when /^@@/ "\033[36m#{line.chomp}\033[0m" else line.chomp end end.join("\n") + "\n" end |