def convert_key_value_to_hash(data)
      return case data
        when Hash then {data[:key] => data[:value]}
        when Array then
          data.inject({}) do |result, item|
            result[item[:key]] = item[:value]
            result
          end
      end
    end
def convert_key_value_to_hash(data)
      return case data
        when Hash then {data[:key] => data[:value]}
        when Array then
          data.inject({}) do |result, item|
            result[item[:key]] = item[:value]
            result
          end
      end
    end
def convert_key_value_to_hash ( data ) return case data when Hash then { data [ :key ] => data [ :value ] } when Array then data . inject ( { } ) do | result , item | result [ item [ :key ] ] = item [ :value ] result end end end
Converts an array containing hashes or a hash with ':key' and ':value'
 keys only into a key -> value hash.
Converts an array containing hashes or a hash with : key and : value keys only into a key - > value hash .