def map( type, &e )
      val = Mapping.new
      e.call( val )
      self << "#{type} " if type.length.nonzero?

      #
      # Empty hashes
      #
      if val.length.zero?
        self << "{}"
        @seq_map = false
      else
        # FIXME
        # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
        #     @headless = 1
        # end

        defkey = @options.delete( :DefaultKey )
        if defkey
          seq_map_shortcut
          self << "= : "
          defkey.to_yaml( :Emitter => self )
        end

        #
        # Emit the key and value
        #
        val.each { |v|
          seq_map_shortcut
          if v[0].is_complex_yaml?
            self << "? "
          end
          v[0].to_yaml( :Emitter => self )
          if v[0].is_complex_yaml?
            self << "\n"
            indent!
          end
          self << ": "
          v[1].to_yaml( :Emitter => self )
        }
      end
    end
def map( type, &e )
      val = Mapping.new
      e.call( val )
      self << "#{type} " if type.length.nonzero?

      #
      # Empty hashes
      #
      if val.length.zero?
        self << "{}"
        @seq_map = false
      else
        # FIXME
        # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
        #     @headless = 1
        # end

        defkey = @options.delete( :DefaultKey )
        if defkey
          seq_map_shortcut
          self << "= : "
          defkey.to_yaml( :Emitter => self )
        end

        #
        # Emit the key and value
        #
        val.each { |v|
          seq_map_shortcut
          if v[0].is_complex_yaml?
            self << "? "
          end
          v[0].to_yaml( :Emitter => self )
          if v[0].is_complex_yaml?
            self << "\n"
            indent!
          end
          self << ": "
          v[1].to_yaml( :Emitter => self )
        }
      end
    end
Quick mapping