flexmock (FlexMock::MockContainer)

         # File lib/flexmock/mock_container.rb, line 115
    115:     def flexmock(*args)
    116:       name = nil
    117:       quick_defs = {}
    118:       domain_obj = nil
    119:       safe_mode = false
    120:       model_class = nil
    121:       while ! args.empty?
    122:         case args.first
    123:         when :base, :safe
    124:           safe_mode = (args.shift == :safe)
    125:           domain_obj = args.shift
    126:         when :model
    127:           args.shift
    128:           model_class = args.shift
    129:         when String, Symbol
    130:           name = args.shift.to_s
    131:         when Hash
    132:           quick_defs = args.shift
    133:         else
    134:           domain_obj = args.shift
    135:         end
    136:       end
    137:       raise UsageError, "a block is required in safe mode" if safe_mode && ! block_given?
    138:
    139:       if domain_obj
    140:         mock = ContainerHelper.make_partial_proxy(self, domain_obj, name, safe_mode)
    141:         result = domain_obj
    142:       elsif model_class
    143:         id = ContainerHelper.next_id
    144:         result = mock = FlexMock.new("#{model_class}_#{id}", self)
    145:       else
    146:         result = mock = FlexMock.new(name || "unknown", self)
    147:       end
    148:       mock.should_receive(quick_defs)
    149:       yield(mock) if block_given?
    150:       flexmock_remember(mock)
    151:       ContainerHelper.add_model_methods(mock, model_class, id) if model_class
    152:       result
    153:     end