vendor/gems/flexmock-0.8.5/lib/flexmock/expectation.rb
def and_return(*args, &block)
      if block_given? 
        @return_queue << block
      else
        args.each do |arg|
          @return_queue << lambda { |*a| arg }
        end
      end
      self
    end
# :call-seq:
#   and_return(value)
#   and_return(value, value, ...)
#   and_return { |*args| code }
#
# Declare that the method returns a particular value (when the
# argument list is matched).
#
# * If a single value is given, it will be returned for all matching
#   calls.
# * If multiple values are given, each value will be returned in turn for
#   each successive call.  If the number of matching calls is greater
#   than the number of values, the last value will be returned for
#   the extra matching calls.
# * If a block is given, it is evaluated on each call and its
#   value is returned.
#
# For example:
#
#  mock.should_receive(:f).returns(12)   # returns 12
#
#  mock.should_receive(:f).with(String). # returns an
#    returns { |str| str.upcase }        # upcased string
#
# +returns+ is an alias for +and_return+.
#


Declare that the method returns a particular value (when the
argument list is matched).

If a single value is given, it will be returned for all matching
calls.
If multiple values are given, each value will be returned in turn for
each successive call.  If the number of matching calls is greater
than the number of values, the last value will be returned for
the extra matching calls.
If a block is given, it is evaluated on each call and its
value is returned.

For example.





+returns+ is an alias for +and_return+.
Declare that the method returns a particular value ( when the argument list is matched ) . If a single value is given it will be returned for all matching calls . If multiple values are given each value will be returned in turn for each successive call . If the number of matching calls is greater than the number of values the last value will be returned for the extra matching calls . If a block is given it is evaluated on each call and its value is returned . For example . + returns + is an alias for + and_return + .
def and_return(*args, &block)
      if block_given? 
        @return_queue << block
      else
        args.each do |arg|
          @return_queue << lambda { |*a| arg }
        end
      end
      self
    end
def and_return ( * args , & block ) if block_given? @return_queue << block else args . each do | arg | @return_queue << lambda { | * a | arg } end end self end
:call-seq:
and_return(value)
and_return(value, value, ...)
and_return { |*args| code }
: call - seq : and_return ( value ) and_return ( value value ... ) and_return { | * args| code }
args
block