0.0
The project is in a healthy, maintained state
A Psych extension to enable choosing output styles for specific objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Project Readme

💄 styled-yaml

A Psych extension to enable choosing output styles for specific objects.

Usage

require 'styled_yaml'
require 'yaml'

recipe = {
  'name' => StyledYAML.double_quoted(+'Fruit Salad'),
  'link' => StyledYAML.single_quoted(+'http://bad.recipes/salad'),
  'ingredients' => StyledYAML.inline(%w[apple pear orange]),
  'steps' => StyledYAML.literal(+<<~STEPS
    1. Dice the fruit into bit size pieces.
    1. Combine the fruit in a bowl.
    1. Enjoy!
  STEPS
  )
}

puts YAML.dump(recipe)
puts StyledYAML.dump(recipe)
---
name: Fruit Salad
link: http://bad.recipes/salad
ingredients:
- apple
- pear
- orange
steps: |
  1. Dice the fruit into bit size pieces.
  1. Combine the fruit in a bowl.
  1. Enjoy!
---
name: "Fruit Salad"
link: 'http://bad.recipes/salad'
ingredients: [apple, pear, orange]
steps: |
  1. Dice the fruit into bit size pieces.
  1. Combine the fruit in a bowl.
  1. Enjoy!

Acknowledgments