Created
August 1, 2010 22:00
-
-
Save johnnygoodman/503814 to your computer and use it in GitHub Desktop.
This file contains 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
require 'rubygems' | |
require 'differ' | |
original = "Epic lolcat fail bellmead drive!" | |
current = "Epic wolfman fail bellmead dr!" | |
diff = Differ.diff_by_word(current, original).to_s | |
# => "Epic {"lolcat" >> "wolfman"} fail bellmead {"drive" >> "dr"}! | |
original = "Same Same diff Same Same diff Same Same diff" | |
current = "Same Same wooo Same Same wooo Same Same wooo" | |
# => "Same Same {"diff" >> "wooo"} Same Same {"diff" >> "wooo"} Same Same {"diff" >> "wooo"}" | |
=begin | |
I won't know how many diffs the strings will have until I run the script. I need to parse how ever many matches I have out of the result string. Each match is in the format: {"diff" >> "wooo"}. I need to write a regexp, split or combo that allows me to put each match into a key,value hash. | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment