summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-09 17:38:28 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-09 17:38:28 +0000
commit51e8c8199cf6068496fa495a00d36fb7e674ce77 (patch)
treea68093c5590b07977a9da19737a3d75be71b15a3 /string.c
parent38117a85b32bdfd8fc96687254fd0b759edaadbf (diff)
merge revision(s) r48747,r48772: [Backport #10582]
* string.c: [DOC] Add missing documentation around String#chomp. Patch by @stderr [ci skip][fix GH-780] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@49911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/string.c b/string.c
index e6f72bc5e7..a9b0b8bcc0 100644
--- a/string.c
+++ b/string.c
@@ -7058,15 +7058,18 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
* from the end of <i>str</i> (if present). If <code>$/</code> has not been
* changed from the default Ruby record separator, then <code>chomp</code> also
* removes carriage return characters (that is it will remove <code>\n</code>,
- * <code>\r</code>, and <code>\r\n</code>).
- *
- * "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"
+ * <code>\r</code>, and <code>\r\n</code>). If <code>$/</code> 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\r\n\r\n".chomp('') #=> "hello"
+ * "hello\r\n\r\r\n".chomp('') #=> "hello\r\n\r"
*/
static VALUE