0.0
No commit activity in last 3 years
No release in over 3 years
Ruby implemention of https://github.com/paulgb/simplediff.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

SimpleDiff Ruby 1.0

simplediff-ruby is a Ruby gem implementation of the simplediff algorithm. It finds the difference between two arrays of strings, numbers, hashes, or arrays.

Use

require the gem to expose the SimpleDiff class.

require "simplediff-ruby"

Then call SimpleDiff.compare to find the diffs.

source = ['The', 'quick', 'brown', 'fox']
target = ['The', 'slow', 'green', 'turtle']
SimpleDiff.compare(source, target)

The output will be an array of hashes representing the differences between the compared arrays.

[
  { change: '=', content: ['The'] },
  { change: '-', content: ['quick', 'brown', 'fox'] },
  { change: '+', content: ['slow', 'green', 'turtle'] }
]

Test

Use ruby test/test.rb to run the test cases.

$ ruby test/test.rb

License

SimpleDiff Ruby is available under a zlib/libpng license. See the provided LICENSE file for more details.