On 2/21/07, Eyal Oren <eyal.oren / gmail.com> wrote:
> E.g. a = 'test\nbreak'. Then "puts a.inspect" doesn't actually print a
> line break, it prints the  characters '\n'. I would like to transform
> "a" into a string that really includes a linebreak instead of the
> characters '\n'.
>

It looks like you're running into the fact that when you create a
string literal with a single quote (') it's treated differently than
when you construct the literal with double quotes...

Observe:
irb(main):001:0> a = 'test\nbreak'
=> "test\\nbreak"
irb(main):002:0> puts a
test\nbreak
=> nil
irb(main):003:0> puts 'whoops'
whoops
=> nil
irb(main):004:0> a = "test\n\break"
=> "test\n\break"
irb(main):005:0> puts a
test
reak
=> nil
irb(main):006:0> puts 'sweet!'
sweet!
=> nil

hth,
-Harold