Project

yaml2csv

0.02
No commit activity in last 3 years
No release in over 3 years
yaml2csv converts between YAML and CSV files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.0.7
~> 0.8.7

Runtime

~> 0.30
 Project Readme
= Yaml2Csv

Transform YAML file into CSV and backwards. CSV files contain
triplets [path, key, value]. For example:

    path1:
      path11:
        key11a: value11a
        key11b: value11b
      path12:
        path121:
          key121a: value121a
    path2:
      key2a: value2a
  
Will be converted into:

    path1/path11,key11a,value11a
    path1/path11,key11b,value11b
    path1/path12/path121,key121a,value121a
    path2,key2a,value2a

YAML source files should contain only hashes and string values. While non-string 
values (i.e. arrays, booleans) are allowed, they will be treated as strings 
thus their original format will be lost.

== Usage 

=== As a gem

In your Gemfile:

    gem 'yaml2csv'

In your code:

    output_string = Yaml2csv::yaml2csv(input_string)
    output_string = Yaml2csv::csv2yaml(input_string)

=== rake task

Convert file.yml into CSV format:

    $ rake yaml2csv:yaml2csv INPUT=file.yml OUTPUT=file.csv

Convert file.csv into YAML format

    $ rake yaml2csv:csv2yaml INPUT=file.csv OUTPUT=file.yml