# File lib/factory_girl/syntax/default.rb, line 15
        def factory(name, options = {}, &block)
          factory = Factory.new(name, options)
          proxy = FactoryGirl::DefinitionProxy.new(factory)
          proxy.instance_eval(&block) if block_given?

          if traits = options.delete(:traits)
            factory.apply_traits(traits)
          end

          if parent = options.delete(:parent)
            factory.inherit_from(FactoryGirl.factory_by_name(parent))
          end
          FactoryGirl.register_factory(factory)

          proxy.child_factories.each do |(child_name, child_options, child_block)|
            factory(child_name, child_options.merge(:parent => name), &child_block)
          end
        end