Sha256: 4a365d2d76970ecdaf46fdd0e2b77f9cbcae9234b66c69f13f59c8dbfe8656ae
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# # Represent a single line of the diff. # class PrettyDiff::Line #:nodoc: attr_reader :diff, :input def initialize(diff, input) @diff = diff @input = input end # Generate HTML presentation for a Line. Return a string. def to_html generator.generate end # Prepare Line contents for injection into HTML structure. # Currently used for replacing Tab symbols with spaces. # Return a string. def format input.gsub("\t", ' ') end # Unified Diff sometimes emit a special line at the end of the file # that we should not display in the output. # Return true or false. def ignore? input =~ /\\ No newline at end of file/ end # Return status of the Line. Can be :added, :deleted or :not_modified. def status case input when /^\+/ :added when /^\-/ :deleted else :not_modified end end def added? status == :added end def deleted? status == :deleted end def not_modified? status == :not_modified end private def generator @_generator ||= PrettyDiff::LineGenerator.new(self) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pretty_diff-0.6.0 | lib/pretty_diff/line.rb |