title: How to convert CSV file into YAML file using Ruby?
body: <p>I have a CSV file where it contains URLs, Fully Qualified Domain Names (FQDN), Domains, IP addresses and ranges of IP addresses. And I would like to convert it to a YAML file on the following format:</p>
  
  <pre><code>entity:    
    name: "company name"   
    network_names:
      url: 
        - 'scheme://host:port/path?query'
        - 'http://www.example.com/software/index.html'
      fqdn:
        - 'mymail.somecollege.edu'
      domain:
        - 'somecollege.edu'
  
  
    network_addresses:
      ipv4:
        single_ip: 
          - 111.11.111.1
        range: 
          - 111.11.111.0-111.11.11.255
  </code></pre>
  
  <p>The problem is that everything is mixed up on the CSV file, for example on the first row there is an IP address but on the next line there is a URL or a FQDN. </p>
  
  <p>So I was thinking that I need to check if a row contains an IP address, URL, FQDN or a domain and from there build the YAML file.</p>
  
  <p>But how do I specify the fields for the YAML file? I'm new on Ruby programming and YAML.</p>