Class: Mocha::ReturnValues

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

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*values) ⇒ ReturnValues

Returns a new instance of ReturnValues.



13
14
15
# File 'lib/mocha/return_values.rb', line 13

def initialize(*values)
  @values = values
end

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



11
12
13
# File 'lib/mocha/return_values.rb', line 11

def values
  @values
end

Class Method Details

.build(*values) ⇒ Object



7
8
9
# File 'lib/mocha/return_values.rb', line 7

def self.build(*values)
  new(*values.map { |value| SingleReturnValue.new(value) })
end

Instance Method Details

#+(other) ⇒ Object



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

def +(other)
  self.class.new(*(@values + other.values))
end

#nextObject



17
18
19
20
21
22
23
# File 'lib/mocha/return_values.rb', line 17

def next
  case @values.length
    when 0 then nil
    when 1 then @values.first.evaluate
    else @values.shift.evaluate
  end
end