Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse a yaml file into ruby hashs and/or arrays?

I need to load a yaml file into Hash,
What should I do?

like image 590
Croplio Avatar asked Aug 14 '10 01:08

Croplio


People also ask

How do I parse a YAML file in Python?

We can read the YAML file using the PyYAML module's yaml. load() function. This function parse and converts a YAML object to a Python dictionary ( dict object). This process is known as Deserializing YAML into a Python.

What is a YAML file?

YAML is a data serialization language that is often used for writing configuration files. Depending on whom you ask, YAML stands for yet another markup language or YAML ain't markup language (a recursive acronym), which emphasizes that YAML is for data, not documents.


1 Answers

I would use something like:

hash = YAML.load(File.read("file_path")) 
like image 138
venables Avatar answered Sep 17 '22 06:09

venables