lib/conject/object_factory.rb
def type_1_constructor(klass, name, object_context, overrides=nil)
      klass ||= class_finder.find_class(name)

      if !klass.object_peers.empty?
        anchor_object_peers object_context, klass.object_peers
      end

      constructor_func = nil
      if klass.has_object_definition?
        object_map = dependency_resolver.resolve_for_class(klass, object_context, overrides)
        constructor_func = lambda do klass.new(object_map) end

      elsif Utilities.has_zero_arg_constructor?(klass)
        # Default construction
        constructor_func = lambda do klass.new end
      else
        # Oops, out of ideas on how to build.
        raise ArgumentError.new("Class #{klass} has no special component needs, but neither does it have a zero-argument constructor.");
      end

      object = nil
      Conject.override_object_context_with object_context do
        begin
          object = constructor_func.call
        rescue Exception => ex
          origin = "#{ex.message}\n\t#{ex.backtrace.join("\n\t")}"
          name ||= "(no name)"
          raise "Error while constructing object '#{name}' of class #{klass}: #{origin}"
        end
      end
    end
def type_1_constructor(klass, name, object_context, overrides=nil)
      klass ||= class_finder.find_class(name)

      if !klass.object_peers.empty?
        anchor_object_peers object_context, klass.object_peers
      end

      constructor_func = nil
      if klass.has_object_definition?
        object_map = dependency_resolver.resolve_for_class(klass, object_context, overrides)
        constructor_func = lambda do klass.new(object_map) end

      elsif Utilities.has_zero_arg_constructor?(klass)
        # Default construction
        constructor_func = lambda do klass.new end
      else
        # Oops, out of ideas on how to build.
        raise ArgumentError.new("Class #{klass} has no special component needs, but neither does it have a zero-argument constructor.");
      end

      object = nil
      Conject.override_object_context_with object_context do
        begin
          object = constructor_func.call
        rescue Exception => ex
          origin = "#{ex.message}\n\t#{ex.backtrace.join("\n\t")}"
          name ||= "(no name)"
          raise "Error while constructing object '#{name}' of class #{klass}: #{origin}"
        end
      end
    end
This implementation is what I'm loosely calling "type 1" or "regular" object creation:
  - Assume we're looking for a class to create an instance with
  - it may or may not have a declared list of named objects it needs to be constructed with