def element(name, *args, &block)

      metadata = @inspector.get_metadata(current_subject, name)
      attributes = args.extract_options!.merge(metadata)

      subject_of_element = if args.empty?
        @inspector.get_value(current_subject, name)
      else
        args.shift
      end

      raise ArgumentError, "too many arguments" unless args.empty?

      representing(subject_of_element) do

        resolved_attributes = resolve_attributes(attributes)
        content_string = content_block = nil

        unless current_subject.nil?
          if block
            unless block == Representative::EMPTY
              content_block = Proc.new { block.call(current_subject) }
            end
          else
            content_string = current_subject.to_s
          end
        end

        generate_element(format_name(name), resolved_attributes, content_string, &content_block)

      end

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

      metadata = @inspector.get_metadata(current_subject, name)
      attributes = args.extract_options!.merge(metadata)

      subject_of_element = if args.empty?
        @inspector.get_value(current_subject, name)
      else
        args.shift
      end

      raise ArgumentError, "too many arguments" unless args.empty?

      representing(subject_of_element) do

        resolved_attributes = resolve_attributes(attributes)
        content_string = content_block = nil

        unless current_subject.nil?
          if block
            unless block == Representative::EMPTY
              content_block = Proc.new { block.call(current_subject) }
            end
          else
            content_string = current_subject.to_s
          end
        end

        generate_element(format_name(name), resolved_attributes, content_string, &content_block)

      end

    end
Generate an element.

 With two arguments, it generates an element with the specified text content.

   r.element :size, 42
   # => <size>42</size>

 More commonly, though, the second argument is omitted, in which case the
 element content is assumed to be the named property of the current #subject.

   r.representing my_shoe do
     r.element :size
   end
   # => <size>9</size>

 If a block is attached, nested elements can be generated.  The element "value"
 (whether explicitly provided, or derived from the current subject) becomes the
 subject during evaluation of the block.

   r.element :book, book do
     r.title
     r.author
   end
   # => <book><title>Whatever</title><author>Whoever</author></book>

 Providing a final Hash argument specifies element attributes.

   r.element :size, :type => "integer"
   # => <size type="integer">9</size>