Module: ColorDiff
- Defined in:
- lib/chef/undev/support/color_diff.rb
Constant Summary collapse
- FILE_IN_R =
/^\-\-\- /- FILE_OUT_R =
/^\+\+\+ /- OUT_R =
/^\-/- IN_R =
/^\+/
Class Method Summary collapse
Class Method Details
.print_diff(array) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/chef/undev/support/color_diff.rb', line 21 def self.print_diff(array) array.each do |line| line.chomp! if line =~ FILE_IN_R puts "#{$MAGENTA}" + line + "#{$RESET}" elsif line =~ FILE_OUT_R puts "#{$BLUE}" + line + "#{$RESET}" elsif line =~ OUT_R puts "#{$RED}" + line + "#{$RESET}" elsif line =~ IN_R puts "#{$GREEN}" + line + "#{$RESET}" else puts line end end end |