class Mocha::ParameterMatchers::Optionally
Parameter matcher which allows optional parameters to be specified.
def initialize(*parameters)
- Private: -
def initialize(*parameters) @matchers = parameters.map(&:to_matcher) end
def matches?(available_parameters)
- Private: -
def matches?(available_parameters) index = 0 while !available_parameters.empty? && (index < @matchers.length) matcher = @matchers[index] return false unless matcher.matches?(available_parameters) index += 1 end true end
def mocha_inspect
- Private: -
def mocha_inspect "optionally(#{@matchers.map(&:mocha_inspect).join(', ')})" end