Class: Minicrest::CollectionItemMatcher Private
- Defined in:
- lib/minicrest/collection_item_matcher.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.
Base class for matchers that apply a matcher to items in a collection.
Instance Method Summary collapse
-
#collection?(actual) ⇒ Boolean
private
Checks if actual is a collection.
-
#initialize(item_matcher) ⇒ CollectionItemMatcher
constructor
private
Creates a new collection item matcher.
Methods inherited from Matcher
#&, #description, #failure_message, #matches?, #negated_failure_message, #|
Constructor Details
#initialize(item_matcher) ⇒ CollectionItemMatcher
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.
Creates a new collection item matcher.
13 14 15 16 |
# File 'lib/minicrest/collection_item_matcher.rb', line 13 def initialize(item_matcher) super() @item_matcher = item_matcher end |
Instance Method Details
#collection?(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.
Checks if actual is a collection.
22 23 24 25 26 |
# File 'lib/minicrest/collection_item_matcher.rb', line 22 def collection?(actual) actual.is_a?(Enumerable) || actual.respond_to?(:each) rescue NoMethodError false end |