Class: Mocha::YieldParameters

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/yield_parameters.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeYieldParameters

Returns a new instance of YieldParameters.



9
10
11
# File 'lib/mocha/yield_parameters.rb', line 9

def initialize
  @parameter_groups = []
end

Instance Method Details

#add(*parameters) ⇒ Object



21
22
23
# File 'lib/mocha/yield_parameters.rb', line 21

def add(*parameters)
  @parameter_groups << SingleYield.new(*parameters)
end

#multiple_add(*parameter_groups) ⇒ Object



25
26
27
# File 'lib/mocha/yield_parameters.rb', line 25

def multiple_add(*parameter_groups)
  @parameter_groups << MultipleYields.new(*parameter_groups)
end

#next_invocationObject



13
14
15
16
17
18
19
# File 'lib/mocha/yield_parameters.rb', line 13

def next_invocation
  case @parameter_groups.length
    when 0 then NoYields.new
    when 1 then @parameter_groups.first
    else @parameter_groups.shift
  end
end