Sha256: bc1e72d8e46ae7ccf41af7833cadd851314857bd8c88da1741769951ee605ae9

Contents?: true

Size: 842 Bytes

Versions: 18

Compression:

Stored size: 842 Bytes

Contents

= ANSI::Diff

  require 'ansi/diff'

  a = 'abcYefg'
  b = 'abcXefg'

  diff = ANSI::Diff.new(a,b)

  diff.to_s.assert == "\e[31mabc\e[0m\e[33mYefg\e[0m\n\e[31mabc\e[0mXefg"

Try another.

  a = 'abc'
  b = 'abcdef'

  diff = ANSI::Diff.new(a,b)

  diff.to_s.assert == "\e[31mabc\e[0m\n\e[31mabc\e[0mdef"

And another.

  a = 'abcXXXghi'
  b = 'abcdefghi'

  diff = ANSI::Diff.new(a,b)

  diff.to_s.assert == "\e[31mabc\e[0m\e[33mXXXghi\e[0m\n\e[31mabc\e[0mdefghi"

And another.

  a = 'abcXXXdefghi'
  b = 'abcdefghi'

  diff = ANSI::Diff.new(a,b)

  diff.to_s.assert == "\e[31mabc\e[0m\e[33mXXX\e[0m\e[35mdefghi\e[0m\n\e[31mabc\e[0m\e[35mdefghi\e[0m"

Comparison that is mostly different.

  a = 'abcpppz123'
  b = 'abcxyzzz43'

  diff = ANSI::Diff.new(a,b)

  diff.to_s.assert == "\e[31mabc\e[0m\e[33mpppz123\e[0m\n\e[31mabc\e[0mxyzzz43"

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-1.0.0 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
swipe-rails-0.0.5 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-1.0.0.beta3 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-1.0.0.beta2 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-1.0.0.beta vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-0.9.1.beta.3 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-0.9.1.beta vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-0.9.0 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
challah-0.8.3 vendor/bundle/gems/ansi-1.4.3/demo/09_diff.rdoc
ansi-1.4.3 demo/09_diff.rdoc
challah-0.6.1 vendor/bundle/gems/ansi-1.4.2/qed/09_diff.rdoc
challah-0.6.0 vendor/bundle/gems/ansi-1.4.2/qed/09_diff.rdoc
ansi-1.4.2 qed/09_diff.rdoc
ansi-1.4.1 qed/09_diff.rb
ansi-1.4.0 qed/09_diff.rb
ansi-1.3.0 qed/09_diff.rb