class Mocha::ParameterMatchers::Optionally

Parameter matcher which allows optional parameters to be specified.

def initialize(*parameters)

Other tags:
    Private: -
def initialize(*parameters)
  @matchers = parameters.map(&:to_matcher)
end

def matches?(available_parameters)

Other tags:
    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

Other tags:
    Private: -
def mocha_inspect
  "optionally(#{@matchers.map(&:mocha_inspect).join(', ')})"
end