Class: Philiprehberger::Approx::RSpecMatchers::BeApproxMatcher Private
- Inherits:
-
Object
- Object
- Philiprehberger::Approx::RSpecMatchers::BeApproxMatcher
- Defined in:
- lib/philiprehberger/approx/rspec_matchers.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #description ⇒ Object private
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(expected, epsilon, rel_tol = 0) ⇒ BeApproxMatcher
constructor
private
A new instance of BeApproxMatcher.
- #matches?(actual) ⇒ Boolean private
Constructor Details
#initialize(expected, epsilon, rel_tol = 0) ⇒ BeApproxMatcher
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BeApproxMatcher.
31 32 33 34 35 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 31 def initialize(expected, epsilon, rel_tol = 0) @expected = expected @epsilon = epsilon @rel_tol = rel_tol end |
Instance Method Details
#description ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 42 def description "be approximately equal to #{@expected.inspect} (#{tolerance_description})" end |
#failure_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 46 def "expected #{@actual.inspect} to be approximately equal to #{@expected.inspect} (#{tolerance_description})" end |
#failure_message_when_negated ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 50 def "expected #{@actual.inspect} not to be approximately equal to #{@expected.inspect} (#{tolerance_description})" end |
#matches?(actual) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 37 def matches?(actual) @actual = actual Approx.equal?(actual, @expected, epsilon: @epsilon, rel_tol: @rel_tol) end |