Sha256: 0ee69c95ecaec79d1cda97a817a0999c8a47f38471284625c80e398c2b0c872d

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

module Differ
  module Format
    module Ascii
      class << self
        def call(change)
          (change.change? && as_change(change)) ||
          (change.delete? && as_delete(change)) ||
          (change.insert? && as_insert(change)) ||
          ''
        end

      private
        def as_insert(change)
          "{+#{change.insert.inspect}}"
        end

        def as_delete(change)
          "{-#{change.delete.inspect}}"
        end

        def as_change(change)
          "{#{change.delete.inspect} >> #{change.insert.inspect}}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ninja-differ-1.0.0 lib/differ/format/ascii.rb