Class: HashesEqual::HashAlmostDiffDisplayer

Inherits:
HashDiffDisplayer show all
Defined in:
lib/hashes_equal/hash_almost_diff_displayer.rb

Defined Under Namespace

Classes: ToleranceMustBeNonNegativeNumeric

Instance Method Summary collapse

Methods inherited from GenericDiffDisplayer

#call, #diff

Constructor Details

#initialize(expected:, actual:, tolerance:, strict: false) ⇒ HashAlmostDiffDisplayer

Returns a new instance of HashAlmostDiffDisplayer.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hashes_equal/hash_almost_diff_displayer.rb', line 9

def initialize(expected:, actual:, tolerance:, strict: false)
  @tolerance = tolerance
  @strict = strict

  super(
    expected: expected,
    actual: actual,
    diff_options: {
      numeric_tolerance: tolerance,
      strict: strict
    }
  )
end