title: Creating string from hash values
body: <p>I have a Hash that looks like this:</p>
  
  <pre><code>{ 'key1' =&gt; 'value1', 'key2' =&gt; ['value2', 'value3']}
  </code></pre>
  
  <p>And I need to create a string that will look like this:</p>
  
  <pre><code>key1/value1;key2/value2,value3
  </code></pre>
  
  <p>So, the pattern is key/value and <code>';'</code> as separator. And if there are more than one value do value1,value2 <code>','</code> is the separator.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>def build_string params
          url_params = ''
        params.each do |key, value|
          url_params += key
          url_params += '/'
          if value.kind_of? Array
            url_params += value.join(",") 
          else
            url_params += value
          end
          url_params += ';'
        end
        return url_params
      end
  </code></pre>
  
  <p>The problem is that this is adding a ';' at the end of the string, and I just want it as separator of each hash element. I have thought of doing a <code>join(';')</code>, but I am not sure how to do the rest of the operations beforehand.</p>