Class: HashesEqual::HashRoundedDiffDisplayer
- Inherits:
-
HashDiffDisplayer
- Object
- GenericDiffDisplayer
- HashDiffDisplayer
- HashesEqual::HashRoundedDiffDisplayer
- Defined in:
- lib/hashes_equal/hash_rounded_diff_displayer.rb
Defined Under Namespace
Classes: PrecisionMustBeNonNegativeInteger
Instance Method Summary collapse
-
#initialize(expected:, actual:, precision:) ⇒ HashRoundedDiffDisplayer
constructor
A new instance of HashRoundedDiffDisplayer.
Methods inherited from GenericDiffDisplayer
Constructor Details
#initialize(expected:, actual:, precision:) ⇒ HashRoundedDiffDisplayer
Returns a new instance of HashRoundedDiffDisplayer.
9 10 11 12 13 14 15 16 17 |
# File 'lib/hashes_equal/hash_rounded_diff_displayer.rb', line 9 def initialize(expected:, actual:, precision:) @precision = precision super(expected: expected, actual: actual) do |_path, left, right| next unless left.is_a?(Numeric) && right.is_a?(Numeric) left.round(precision) == right.round(precision) end end |