def to_dot_attributes(hash)
      # TODO: fix uncompatible key names
      # TODO: some values must be encoded (backquoting and the like)
      buffer = ""
      hash.each_pair do |k,v|
        buffer << " " unless buffer.empty?
        v = case v
          when Array
            if v.all?{|elm| Array===elm and elm.length==2 and elm.all?{|subelm| Numeric===subelm}}
              v.inject('') {|memo, elm| "#{memo} #{elm.join(',')}"}.strip
            else
              v.join(', ')
            end
          else
            v.to_s
        end
        buffer << "#{k}=\"#{v}\""
      end
      buffer
    end
def to_dot_attributes(hash)
      # TODO: fix uncompatible key names
      # TODO: some values must be encoded (backquoting and the like)
      buffer = ""
      hash.each_pair do |k,v|
        buffer << " " unless buffer.empty?
        v = case v
          when Array
            if v.all?{|elm| Array===elm and elm.length==2 and elm.all?{|subelm| Numeric===subelm}}
              v.inject('') {|memo, elm| "#{memo} #{elm.join(',')}"}.strip
            else
              v.join(', ')
            end
          else
            v.to_s
        end
        buffer << "#{k}=\"#{v}\""
      end
      buffer
    end
Converts a hash to dot attributes