[ruby-core:68000] [ruby-trunk - Bug #10824] [Assigned] to_yaml incorrectly inserts return lines

From: nobu@...
Date: 2015-02-04 07:41:49 UTC
List: ruby-core #68000
Issue #10824 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Assigned
Assignee set to Aaron Patterson

Maybe a word wrapping?

----------------------------------------
Bug #10824: to_yaml incorrectly inserts return lines
https://bugs.ruby-lang.org/issues/10824#change-51389

* Author: Christopher Thielen
* Status: Assigned
* Priority: Normal
* Assignee: Aaron Patterson
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
~~~ruby
"{\"config_path\":\"something\",\"mode\":\"something_underscore\",\"person\=
":{\"id\":1,\"name\":\"Christopher Michael Thielen\",\"address\":\"First Sh=
ields Ave\"}}".to_yaml
~~~
returns:

~~~ruby
"--- '{\"config_path\":\"something\",\"mode\":\"something_underscore\",\"pe=
rson\":{\"id\":1,\"name\":\"Christopher\n  Michael Thielen\",\"address\":\"=
First Shields Ave\"}}'\n"
~~~

Note that a newline has been inserted after the word =E2=80=98Christopher=
=E2=80=99. It shouldn=E2=80=99t be there.

Curiously enough, if we leave out, say, the =E2=80=9Cmode=E2=80=9D key, the=
 newline shifts around:

~~~ruby
"{\"config_path\":\"something\",\"person\":{\"id\":1,\"name\":\"Christopher=
 Michael Thielen\",\"address\":\"First Shields Ave\"}}".to_yaml
~~~

returns:

~~~ruby
"--- '{\"config_path\":\"something\",\"person\":{\"id\":1,\"name\":\"Christ=
opher Michael Thielen\",\"address\":\"First\n  Shields Ave\"}}'\n"
~~~

Note that the newline isn=E2=80=99t after =E2=80=98Christopher' anymore but=
 is after the word =E2=80=98First=E2=80=99.

This functionality appears in at least:

ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]

and

ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]




--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next