Hi,
while we’re at it …
I try to make YAML fold newlines. Sometimes it does, sometimes it
doesn’t. Does anyone has an idea of what’s happening here? Or is
this just the way YAML works? Thanks.
require ‘yaml’
text =
"Just got my (dead-tree, printed-on-paper, " +
"I don’t know if there’s a web " +
“version) copy of Linux Magazine for September, 2002.” +
"There’s an article by " +
“Dave Thomas about building networked applications in Ruby.” +
“Props to Dave!” # i.e., no newlines
hash = { ‘key’ => text }
puts text.to_yaml( :UseFold => true,
:BestWidth => 15 )
produces:
— >-
Just got my
(dead-tree,
printed-on-pap
r, I don’t know
if there’s a
web version)
copy of Linux
Magazine for
September,
2002. There’s
an article by
Dave Thomas
about building
networked
applications in
Ruby. Props to
Dave!
puts hash.to_yaml( :UseFold => true,
:BestWidth => 15 )
produces:
···
key: “Just got my (dead-tree, printed-on-paper, I don’t know if
there’s a web version) copy of Linux Magazine for September, 2002.
There’s an article by Dave Thomas about building networked
applications in Ruby. Props to Dave!”