lib/type_contracts/return.rb
def returns(contract = NO_CONTRACT, &block)
        contract = TypeContracts::Return.new(contract, &block)

        @__type_contracts__last_annotation ||= {}
        raise 'A contract already exists for the return value' if @__type_contracts__last_annotation[:return]

        @__type_contracts__last_annotation[:return] = contract
      end
# Defines a contract for a return value for the next method that gets defined.
# Only one `returns` contract can be defined for any particular method
#
# @param contract
#   the contract for the return value.  This could be a specific value (eg '1'),
#   a class (eg String), an array of possible values or matches (eg [String, Symbol]),
#   or a matcher that that has a no-arg constructor.  This can also be excluded and
#   a block provided instead; the block accepts the return value of the method and must
#   return a boolean value
Defines a contract for a return value for the next method that gets defined.
Only one `returns` contract can be defined for any particular method
Defines a contract for a return value for the next method that gets defined . Only one ` returns ` contract can be defined for any particular method
def returns(contract = NO_CONTRACT, &block)
        contract = TypeContracts::Return.new(contract, &block)
        @__type_contracts__last_annotation ||= {}
        raise 'A contract already exists for the return value' if @__type_contracts__last_annotation[:return]
        @__type_contracts__last_annotation[:return] = contract
      end
def returns ( contract = NO_CONTRACT , & block ) contract = TypeContracts :: Return . new ( contract , & block ) @__type_contracts__last_annotation ||= { } raise 'A contract already exists for the return value' if @__type_contracts__last_annotation [ :return ] @__type_contracts__last_annotation [ :return ] = contract end
Defines a contract for a return value for the next method that gets defined.
Defines a contract for a return value for the next method that gets defined .
contract
the contract for the return value. This could be a specific value , a class , an array of possible values or matches , or a matcher that that has a no-arg constructor. This can also be excluded and a block provided instead; the block accepts the return value of the method and must return a boolean value
the contract for the return value . This could be a specific value a class an array of possible values or matches or a matcher that that has a no - arg constructor . This can also be excluded and a block provided instead ; the block accepts the return value of the method and must return a boolean value
block