Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Crystal sequence differencing implementation.
Based on the algorithm proposed in "An O(NP) Sequence Comparision Algorithm" (Wu, 1989)
Add this to your application's shard.yml
:
dependencies:
diff:
github: MakeNowJust/crystal-diff
require "colorize"
require "../src/diff"
Diff.diff("hello world", "hello good-bye").each do |chunk|
print chunk.data.colorize(
chunk.append? ? :green : chunk.delete? ? :red : :dark_gray)
end
puts
$ crystal spec