Update value in key value pair in yml file using ruby
<p>I have a YAML file:</p>

<pre><code>DATA_SVC_GEN_CONF_ATTR:
   -
     -   
       - 
         name: validationCodeNum
         value: 1
       - 
         name: validationCodeSymbol
         value: "val1"
       - 
         name: sql
         value: Test
       - 
         name: sqlByGridArea
         value: Test1
</code></pre>

<p>I want to replace the value of the key <code>sql</code> from "Test" to "Select * from table".</p>

<p>What I am trying is:</p>

<pre><code>asset.getAttributes.getList.each{|a|

  if a.getName == "sqlByGridArea"
     a.setValue "Select * from table"

    (attrib_defs).map!{|a| a.map{|k,v| "#{k}=#{v}"}.join(',')}
  end
   asset.with_attributes attrib_defs
</code></pre>