0

I am tracking changes in a web-page using Ruby. After I removed all html tags and blank lines, I get an array of lines which needs to be checked for additions/removals assuming that there may be repetitions. Could you recommend a good gem if it has been done already?

I could make the array lines unique and then the problem is avoided. But what if I need to track the repeated lines as well with respect to their position in the text?

Andrei
  • 10,918
  • 12
  • 76
  • 110

1 Answers1

2

Sounds like a textbook case of where you'd want to use the Diff algorithm.

There's a 'diff' gem, although to be fair I've never used it: http://rubygems.org/gems/diff

Sérgio Gomes
  • 720
  • 5
  • 14