class RubyDiff::ArrayDiffer

Public Instance Methods

diff(a,b) click to toggle source
# File lib/rubydiff/kernel.rb, line 103
def diff(a,b)
        diffs = Diffs.new
        if a.count!=b.count
                diffs.add(Diff.new(:different_size,"#{a.count} vs. #{b.count}"))
        else
                a.each_with_index do |el_a, i|
                        diffs.add_sub("index #{i}",Differ.diff(el_a,b[i]))
                end
        end
        diffs
end