Sha256: a4b605ab7a6b31a0dbfd25895d86d040103af4b21c9a1f2a378635df8e4847bd

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module Differ
  module Format
    module HTML
      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)
          %Q{<ins class="differ">#{change.insert}</ins>}
        end

        def as_delete(change)
          %Q{<del class="differ">#{change.delete}</del>}
        end

        def as_change(change)
          as_delete(change) << as_insert(change)
        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/html.rb