UseFold in YAML

  • Thread starter Gerard A.W. Vreeswijk
  • Start date
G

Gerard A.W. Vreeswijk

Hi there,

I try YAML to fold newlines. Sometimes it does, sometimes it doesn't.
What's happening here? 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!"

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,351
Latest member
LolaD32479

Latest Threads

Top