Module Diffy::Format
In: lib/diffy/format.rb

Methods

color   html   html_simple   text  

Public Instance methods

ANSI color output suitable for terminal output

[Source]

# File lib/diffy/format.rb, line 4
    def color
      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

Html output which does inline highlighting of changes between two lines.

[Source]

# File lib/diffy/format.rb, line 33
    def html
      HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s
    end

Basic html output which does not attempt to highlight the changes between lines, and is more performant.

[Source]

# File lib/diffy/format.rb, line 28
    def html_simple
      HtmlFormatter.new(self, options).to_s
    end

Basic text output

[Source]

# File lib/diffy/format.rb, line 22
    def text
      to_a.join
    end

[Validate]