Class: Mocha::ParameterMatchers::AnyOf
- Defined in:
- lib/mocha/parameter_matchers/any_of.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(*matchers) ⇒ AnyOf
constructor
A new instance of AnyOf.
- #matches?(available_parameters) ⇒ Boolean
- #mocha_inspect ⇒ Object
Methods inherited from Base
#&, #to_matcher, #|
Constructor Details
#initialize(*matchers) ⇒ AnyOf
Returns a new instance of AnyOf.
30 31 32 |
# File 'lib/mocha/parameter_matchers/any_of.rb', line 30 def initialize(*matchers) @matchers = matchers end |
Instance Method Details
#matches?(available_parameters) ⇒ Boolean
34 35 36 37 |
# File 'lib/mocha/parameter_matchers/any_of.rb', line 34 def matches?(available_parameters) parameter = available_parameters.shift @matchers.any? { |matcher| matcher.to_matcher.matches?([parameter]) } end |
#mocha_inspect ⇒ Object
39 40 41 |
# File 'lib/mocha/parameter_matchers/any_of.rb', line 39 def mocha_inspect "any_of(#{@matchers.map { |matcher| matcher.mocha_inspect }.join(", ") })" end |