diff --git a/ChangeLog b/ChangeLog index 0d1c540981..bb994480e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 9 20:24:41 2014 SHIBATA Hiroshi + + * string.c: [DOC] Add missing documentation around String#chomp. + Patchby @stderr [ci skip][fix GH-780] + Tue Dec 9 18:20:02 2014 Nobuyoshi Nakada * object.c: [DOC] Revise documentation by Marcus Stollsteimer at diff --git a/string.c b/string.c index 95c773bf02..4d82d9ba87 100644 --- a/string.c +++ b/string.c @@ -7161,15 +7161,18 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str) * from the end of str (if present). If $/ has not been * changed from the default Ruby record separator, then chomp also * removes carriage return characters (that is it will remove \n, - * \r, and \r\n). + * \r, and \r\n). If $/ is an empty string, + * it will remove all trailing newlines from the string. * - * "hello".chomp #=> "hello" - * "hello\n".chomp #=> "hello" - * "hello\r\n".chomp #=> "hello" - * "hello\n\r".chomp #=> "hello\n" - * "hello\r".chomp #=> "hello" - * "hello \n there".chomp #=> "hello \n there" - * "hello".chomp("llo") #=> "he" + * "hello".chomp #=> "hello" + * "hello\n".chomp #=> "hello" + * "hello\r\n".chomp #=> "hello" + * "hello\n\r".chomp #=> "hello\n" + * "hello\r".chomp #=> "hello" + * "hello \n there".chomp #=> "hello \n there" + * "hello".chomp("llo") #=> "he" + * "hello\r\n\r\n".chomp('') #=> "hello" + * "hello\r\n\r\r\n".chomp('') #=> "hello\r\n\r" */ static VALUE