Learned something interesting (to me) today.
In a fixture file I’m using to test some db code, I need a field to
contain an empty string. I had no idea how to encode that in YAML. I
checked the faq but it consists of one entry about tabs.
I also searched this list and the Rails list going back to Jan 2005
and came up dry.
irb to the rescue:
cremes$ irb
irb(main):001:0> require ‘yaml’
=> true
irb(main):002:0> empty = “”
=> “”
irb(main):003:0> empty.to_yaml
=> “— “”\n”
I put that into my fixture file (just the “”) and everything is
peachy. Next time I’ll experiment with irb first.
cr