Sha256: b9d43653909a465c13e153435632322aed7a7b76f31cffe318e1e141fb736559

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 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

2 entries across 2 versions & 1 rubygems

Version Path
pretty_diff-2.0.1 lib/pretty_diff/line.rb
pretty_diff-2.0.0 lib/pretty_diff/line.rb