Class: Aruba::Matchers::IncludeAnObject Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- Aruba::Matchers::IncludeAnObject
- Includes:
- Base::MessageIndenter
- Defined in:
- lib/aruba/matchers/collection/include_an_object.rb
Overview
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.
Provides the implementation for include_an_object
.
Not intended to be instantiated directly.
Constant Summary
Constants inherited from BaseMatcher
Instance Attribute Summary
Attributes inherited from BaseMatcher
#actual, #expected, #rescued_exception
Instance Method Summary collapse
- #description ⇒ String private
- #does_not_match?(actual) ⇒ Boolean private
- #failure_message ⇒ String private
-
#initialize(matcher) ⇒ IncludeAnObject
constructor
private
A new instance of IncludeAnObject.
Methods included from Base::MessageIndenter
Methods inherited from BaseMatcher
#description_of, #iterable?, #matches?
Methods included from BaseMatcher::DefaultFailureMessages
Methods included from BaseMatcher::HashFormatting
Constructor Details
#initialize(matcher) ⇒ IncludeAnObject
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 IncludeAnObject.
23 24 25 26 27 |
# File 'lib/aruba/matchers/collection/include_an_object.rb', line 23 def initialize(matcher) @matcher = matcher @failed_objects = [] @any_succeeded_object = false end |
Instance Method Details
#description ⇒ String
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/aruba/matchers/collection/include_an_object.rb', line 45 def description improve_hash_formatting "include an object #{description_of matcher}" end |
#does_not_match?(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.
49 50 51 52 53 54 55 56 57 |
# File 'lib/aruba/matchers/collection/include_an_object.rb', line 49 def does_not_match?(actual) @actual = actual return false unless iterable? index_objects any_succeeded_object == false end |
#failure_message ⇒ String
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.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/aruba/matchers/collection/include_an_object.rb', line 31 def return "#{improve_hash_formatting(super)}, but was not iterable" unless iterable? return failed_objects.first if failed_objects.size == 1 = [improve_hash_formatting(super)] failed_objects.each_with_index do |, index| << (index, ) end .join("\n\n") end |