Created
June 3, 2010 19:03
-
-
Save rjungemann/424310 to your computer and use it in GitHub Desktop.
Using the diff-lcs gem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # an example of using the diff-lcs gem | |
| # a mirror of the gem is hosted at http://github.com/defunkt/diff-lcs | |
| # or `gem install diff-lcs` | |
| require 'diff/lcs' | |
| first, second = "hello, world!", "Hello, world!" | |
| diff = Diff::LCS.diff(first, second) | |
| patched = Diff::LCS.patch!(first, diff) | |
| puts("Does the patched string equal the expected string?") | |
| puts(second == patched) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment