ruby on rails - Storing information inside YAML -


I looked up and could not find the answer.

I have a list of many employees. Each has the name, phone and email, such as:

  employee: name | Phone | Email John 111 a@b.com joe 123 b@a.org joan 321 c@a.net  

How do I write the above information in YAML to finish with the following Rabi output? ?

Employees = [[::: name = & gt; 'John' ,: Phone = & gt; '111',: Email = & gt; 'A@b.com'}, {: name = & gt; 'Joe' ,: Phone = & gt; '123' ,: Email = & gt; 'B@a.org'}, {: name = & gt; 'Zone',: phone = & gt; '321',: Email = & gt; 'C@a.net'}]

In this way I analyze the YAML file:

  APP_CONFIG = YAML.load_file ("# { RAILS_ROOT} /config/config.yml ")  

Thanks!

  - name: John Phone: 111 Email: a@b.com - Name: Joe Phone: 123 Email: b@a.org - Name: Zone Phone: 321 Email: c@a.net  

Output is a string key, not a symbol key, but in fact, if necessary You can make that conversion yourself


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -