Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yaml Reader

Written for fun one evening as an exercise in Ruby. My goal was an easy way to load any YAML file and interact with it using dot notation.

Perhaps you have a YAML file:

---
title: Amazing Content

Instantiate a YAML Reader object

yaml = YAMLReader.new 'path/to/yaml_file.yaml'

Fetch data from the file

yaml.title
# "Amazing Content"

Add and update data

yaml.title = "Even More Amazing Content!"
yaml.description = "..."

yaml.title
# "Even More Amazing Content!"

yaml.description
# "..."

Dump the data to string to be written to new YAML file

yaml.dump

# ---
# title: Even More Amazing Content!
# description: ...

Write the updated YAML data to file

yaml.save_as '/path/to/new_yaml_file.yaml'
# true
yaml.save
# true

About

For reading, interacting with, and saving YAML files in Ruby

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages