Sha256: 51c03c9b7f705c0ce65c343748be9787d22d43209c04767ca1985ffc6acbf663

Contents?: true

Size: 538 Bytes

Versions: 50

Compression:

Stored size: 538 Bytes

Contents

require 'mocha/single_return_value'

module Mocha # :nodoc:
  
  class ReturnValues # :nodoc:
    
    def self.build(*values)
      new(*values.map { |value| SingleReturnValue.new(value) })
    end
    
    attr_accessor :values
    
    def initialize(*values)
      @values = values
    end
    
    def next
      case @values.size
      when 0: nil
      when 1: @values.first.evaluate
      else @values.shift.evaluate
      end
    end
    
    def +(other)
      self.class.new(*(@values + other.values))
    end
    
  end
  
end

Version data entries

50 entries across 50 versions & 4 rubygems

Version Path
redcar-0.5.2dev lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.5.1dev lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.4.1 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.4 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.10.1dev lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.10.0dev lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.9 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.9.0dev lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.8.4 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.8.3 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.8.2 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.8.1 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.8 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.7.1 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.7 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.6 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.5 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.4.3 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.4.2 lib/openssl/mocha/lib/mocha/return_values.rb
redcar-0.3.4.1 lib/openssl/mocha/lib/mocha/return_values.rb