Class: Lookout::Equality::Array
- Defined in:
- lib/lookout/equality.rb
Instance Method Summary collapse
Methods inherited from Object
Instance Method Details
#diff(expected, actual) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/lookout/equality.rb', line 104 def diff(expected, actual) return 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)))).to_a.join("\n") end |
#equal?(expected, actual) ⇒ Boolean
96 97 98 99 100 101 102 |
# File 'lib/lookout/equality.rb', line 96 def equal?(expected, actual) return false unless Array === actual and expected.size == actual.size expected.each_with_index do |v, i| return false unless Lookout::Equality.equal? v, actual[i] end true end |