Sha256: ec671e3e1411caf014a59432c46605493580195d7cda4d27f749f857c25dad4e

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

require 'mocha/no_yields'
require 'mocha/single_yield'
require 'mocha/multiple_yields'

module Mocha # :nodoc:
  
  class YieldParameters # :nodoc:
    
    def initialize
      @parameter_groups = []
    end
    
    def next_invocation
      case @parameter_groups.length
      when 0; NoYields.new
      when 1; @parameter_groups.first
      else @parameter_groups.shift
      end
    end
    
    def add(*parameters)
      @parameter_groups << SingleYield.new(*parameters)
    end
    
    def multiple_add(*parameter_groups)
      @parameter_groups << MultipleYields.new(*parameter_groups)
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mocha-0.5.6 lib/mocha/yield_parameters.rb
mocha-0.9.0 lib/mocha/yield_parameters.rb