Class: Lookout::Difference::Hash

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

Overview

Difference reports between Hashes. These reports are generated by turning the Hashes into Arrays, sorting them by key, and finally mapping the keys and values to their String inspections.

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

#diffLookout::Diff::Formats::Set, super

Returns A set “diff” unless Object#expected contains one element or Object#actual isn’t a Hash, super otherwise.

Returns:



10
11
12
13
14
15
16
# File 'lib/lookout-3.0/difference/hash.rb', line 10

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