123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::AndReturnImplementation Private

Relationships & Source Files
Inherits: Object
Defined in: rspec-mocks/lib/rspec/mocks/message_expectation.rb

Overview

Handles the implementation of an and_return implementation.

Other Constraints

Constructor Details

.new(values_to_return) ⇒ AndReturnImplementation

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 722

def initialize(values_to_return)
  @values_to_return = values_to_return
end

Instance Method Details

#call(*_args_to_ignore, &_block)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 726

def call(*_args_to_ignore, &_block)
  if @values_to_return.size > 1
    @values_to_return.shift
  else
    @values_to_return.first
  end
end