Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'psych'
list = ('a'..'z').to_a
# Create a YAML AST
viz = Psych::Visitors::YAMLTree.new {}
viz << list
tree = viz.tree
# Change the Sequence node to be FLOW style
tree.children.first.children.first.style = Psych::Nodes::Sequence::FLOW
# Output as YAML
puts tree.to_yaml
# Or just use JSON style (it defaults to flow)
puts Psych.to_json list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.