Class: Lookout::Difference::Array

Inherits:
Object show all
Defined in:
lib/lookout-3.0/difference/array.rb

Overview

Difference reports between Arrays.

Instance Attribute Summary

Attributes inherited from Object

#actual, #expected

Instance Method Summary collapse

Methods inherited from Object

#==, #hash, #initialize, #message, #to_s

Constructor Details

This class inherits a constructor from Lookout::Difference::Object

Instance Method Details

#diffDiff::Formats::Unified, super

Returns A unified “diff” between Object#actual and Object#expected unless Object#expected contains one element or Object#actual isn’t an Array, super otherwise.

Returns:



8
9
10
11
12
13
14
15
# File 'lib/lookout-3.0/difference/array.rb', line 8

def diff
  return super if expected.size == 1 or not Array === actual
  Lookout::Diff::Formats::Unified.
    new(Lookout::Diff::Groups.
          new(Lookout::Diff::Operations.
                new(Lookout::Diff::Algorithms::Difflib.
                      new(actual, expected))))
end