Sha256: d4ec6fd8b3ae4cbcfe2e592ed475c053b6a25095517f11ac73663f63d3ae99f3

Contents?: true

Size: 601 Bytes

Versions: 5

Compression:

Stored size: 601 Bytes

Contents

module PrettyDiff
  class Line
    attr_reader :chunk, :contents
    attr_accessor :left_number, :right_number

    def initialize(chunk, contents)
      @chunk = chunk
      @contents = contents
    end

    def ignored?
      contents =~ /\\ No newline at end of file/
    end

    def status
      case contents
      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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pretty_diff-2.1.4 lib/pretty_diff/line.rb
pretty_diff-2.1.3 lib/pretty_diff/line.rb
pretty_diff-2.1.2 lib/pretty_diff/line.rb
pretty_diff-2.1.1 lib/pretty_diff/line.rb
pretty_diff-2.1.0 lib/pretty_diff/line.rb