Class: IdentityParade::Matchers::ArrayMatcher

Inherits:
IdentityParade::Matcher show all
Defined in:
lib/identity_parade/matchers/array_matcher.rb

Overview

This matcher checks the similarity of two arrays. For this purpose, it iterates over all elements and creates a new matcher for every type.

Instance Attribute Summary

Attributes inherited from IdentityParade::Matcher

#left, #right

Instance Method Summary collapse

Methods inherited from IdentityParade::Matcher

#initialize

Constructor Details

This class inherits a constructor from IdentityParade::Matcher

Instance Method Details

#scoreObject



6
7
8
9
10
11
# File 'lib/identity_parade/matchers/array_matcher.rb', line 6

def score
  return if left.empty?
  return 0 unless right.is_a? Array

  1 - ((left - right).size / left.size.to_f)
end