Sha256: c7ac47a45891346e794b18fa45d9e98c39131435458e000b85b2764ca8f903ce

Contents?: true

Size: 532 Bytes

Versions: 1

Compression:

Stored size: 532 Bytes

Contents

module Differ
  class Change # :nodoc:
    attr_accessor :insert, :delete
    def initialize(options = {})
      @insert = options[:insert] || ''
      @delete = options[:delete] || ''
    end

    def insert?
      !@insert.empty?
    end

    def delete?
      !@delete.empty?
    end

    def change?
      !@insert.empty? && !@delete.empty?
    end

    def to_s
      Differ.format.call(self)
    end
    alias :inspect :to_s

    def ==(other)
      self.insert == other.insert && self.delete == other.delete
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ninja-differ-1.0.0 lib/differ/change.rb