How to convert a string containing newline characters to multiline yaml
I have a string similar to the following:
test_string = "This is a multiple line string \n
containing new line characters. \n
Another new line."
I'm trying to use the to_yaml function to convert it to a multi-line yaml
string but it automatically escapes the new line characters.
test_string.to_yaml
outputs:
=> "--- ! This is a multiple line string \\ncontaining new line characters.
\\nAnother new line."
How do you create a string that contains "\n" and parse it into yaml?
No comments:
Post a Comment