def list_of(name, *args, &block)

      options = args.extract_options!
      list_subject = args.empty? ? name : args.shift
      raise ArgumentError, "too many arguments" unless args.empty?

      list_attributes = options[:list_attributes] || {}
      item_name = options[:item_name] || name.to_s.singularize
      item_attributes = options[:item_attributes] || {}

      items = resolve_value(list_subject)
      element(name, items, list_attributes.merge(:type => proc{"array"})) do
        items.each do |item|
          element(item_name, item, item_attributes, &block)
        end
      end

    end
def list_of(name, *args, &block)

      options = args.extract_options!
      list_subject = args.empty? ? name : args.shift
      raise ArgumentError, "too many arguments" unless args.empty?

      list_attributes = options[:list_attributes] || {}
      item_name = options[:item_name] || name.to_s.singularize
      item_attributes = options[:item_attributes] || {}

      items = resolve_value(list_subject)
      element(name, items, list_attributes.merge(:type => proc{"array"})) do
        items.each do |item|
          element(item_name, item, item_attributes, &block)
        end
      end

    end
Generate a list of elements from Enumerable data.

   r.list_of :books, my_books do
     r.element :title
   end
   # => <books type="array">
   #      <book><title>Sailing for old dogs</title></book>
   #      <book><title>On the horizon</title></book>
   #      <book><title>The Little Blue Book of VHS Programming</title></book>
   #    </books>

 Like #element, the value can be explicit, but is more commonly extracted
 by name from the current #subject.