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) ⇒ BeApproxMatcher
constructor
private
A new instance of BeApproxMatcher.
- #matches?(actual) ⇒ Boolean private
Constructor Details
#initialize(expected, epsilon) ⇒ 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.
27 28 29 30 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 27 def initialize(expected, epsilon) @expected = expected @epsilon = epsilon 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.
37 38 39 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 37 def description "be approximately equal to #{@expected.inspect} (epsilon: #{@epsilon})" 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.
41 42 43 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 41 def "expected #{@actual.inspect} to be approximately equal to #{@expected.inspect} (epsilon: #{@epsilon})" 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.
45 46 47 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 45 def "expected #{@actual.inspect} not to be approximately equal to #{@expected.inspect} (epsilon: #{@epsilon})" 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.
32 33 34 35 |
# File 'lib/philiprehberger/approx/rspec_matchers.rb', line 32 def matches?(actual) @actual = actual Approx.equal?(actual, @expected, epsilon: @epsilon) end |