Class: RSpec::Mocks::AndReturnImplementation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb

Overview

Handles the implementation of an ‘and_return` implementation.

Other Constraints collapse

Constructor Details

#initialize(values_to_return) ⇒ AndReturnImplementation

Returns a new instance of AndReturnImplementation.



722
723
724
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/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) ⇒ Object



726
727
728
729
730
731
732
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/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