[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

UseFold in YAML

gv

11/3/2003 1:41:00 PM

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:
---
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!"