Sha256: 3b7306e7f0b7343c00e507f13722c3101e486e3a8313059970ec2bb71e348b82

Contents?: true

Size: 884 Bytes

Versions: 83

Compression:

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

83 entries across 41 versions & 13 rubygems

Version Path
josufst_palindrome-0.2.0 vendor/cache/gems/ansi-1.5.0/demo/09_diff.md
josufst_palindrome-0.1.1 vendor/cache/gems/ansi-1.5.0/demo/09_diff.md
josufst_palindrome-0.1.1 vendor/cache/ruby/2.6.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.8 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.7 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.6/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.7 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.6 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.2 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.2 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.1 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.1 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md
paynow_sdk-0.1.0 vendor/cache/ruby/2.7.0/gems/ansi-1.5.0/demo/09_diff.md