Skip to content

Instantly share code, notes, and snippets.

@rjungemann
Created June 3, 2010 19:03
Show Gist options
  • Save rjungemann/424310 to your computer and use it in GitHub Desktop.
Save rjungemann/424310 to your computer and use it in GitHub Desktop.
Using the diff-lcs gem
# 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