def config(key, default=nil, attrs={}, &block)
      orig_attrs = attrs.dup
      
      if nest_class = guess_nest_class(default, block)
        default = nest_class.new
      end
      
      if default.kind_of?(Configurable)
        attrs[:configurable] = default
        default = default.config.to_hash
      end
      
      attrs[:default]  = default
      attrs[:type]     = guess_config_type(attrs).new(attrs)
      attrs[:metadata] = guess_config_metadata(Lazydoc.register_caller).merge!(orig_attrs)
      config_class     = guess_config_class(attrs)
      
      config = define_config(key, attrs, config_class)
      
      if nest_class
        const_name = attrs[:const_name] || guess_nest_const_name(config)
        unless const_defined?(const_name)
          const_set(const_name, nest_class)
        end
      end

      config
    end
def config(key, default=nil, attrs={}, &block)
      orig_attrs = attrs.dup
      
      if nest_class = guess_nest_class(default, block)
        default = nest_class.new
      end
      
      if default.kind_of?(Configurable)
        attrs[:configurable] = default
        default = default.config.to_hash
      end
      
      attrs[:default]  = default
      attrs[:type]     = guess_config_type(attrs).new(attrs)
      attrs[:metadata] = guess_config_metadata(Lazydoc.register_caller).merge!(orig_attrs)
      config_class     = guess_config_class(attrs)
      
      config = define_config(key, attrs, config_class)
      
      if nest_class
        const_name = attrs[:const_name] || guess_nest_const_name(config)
        unless const_defined?(const_name)
          const_set(const_name, nest_class)
        end
      end

      config
    end
Defines a config after guessing or setting some standard values into
 attrs. Specifically:

 * :default is the default
 * :caster is the caster block (if provided)
 * :desc is set using Lazydoc (unless already set)
 * :list is set to true for array defaults (unless already set)

 In addition config also guesses the type of a config (if not manually
 specified by :type) and merges in any attributes for the corresponding
 config_type.  The class of the config is guessed from the attrs, based
 on the :list and :options attributes using this logic:

   :list  :otions   config_class
   ---------------------------
   false  false     Config
   true   false     List
   false  true      Select
   true   true      ListSelect

 == Usage Note

 Config is meant to be a convenience method.  It gets most things right
 but if the attrs logic is too convoluted (and at times it is) then
 define configs manually with the define_config method.